LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-05-2010, 10:20 PM   #1
wisnoskij
LQ Newbie
 
Registered: May 2010
Posts: 9

Rep: Reputation: 0
Concatenate and labeling files


I have an assignment question that I have been making no progress on.

I need a single line command to concatenate a group of files together and clearly label those files in the output.

I assume that just cramming a bunch of commands onto one line will not be considered OK.

and it has to work on some old version of Solaris (which I have been having trouble with normal commands not working the same all day on), but if you just have solutions for any normal Linux shell at least I would have an idea of what I am looking for.

I have looked though cat's man page up and down and I am pretty sure it cannot do what I want, and cannot seem to find any other commands that even concatenate a grouping of files together.

Thanks for any help in advance.
 
Old 05-05-2010, 10:26 PM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,552

Rep: Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899
Quote:
I need a single line command to concatenate a group of files together and clearly label those files in the output.
Maybe you would clarify a little further? ie concatenate the names, the contents or the files (ie tar)

As this is a homework question, what have you tried? Show us your code and what errors or problems you are running into and maybe we can shed some light.
 
Old 05-05-2010, 10:38 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,412

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
What exactly do you mean by
Quote:
clearly label those files in the output.
show an example

Last edited by Tinkster; 05-05-2010 at 11:00 PM. Reason: fixed markup
 
Old 05-06-2010, 07:47 AM   #4
wisnoskij
LQ Newbie
 
Registered: May 2010
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks for your help, but I just figured it out with help from the TA.
They were looking for: tar, more, or less

@grail:
So hopefully it it more obvious now, concatenate the contents of the file, and i had tried nothing as I could not find a command that did what I needed.
@chrism01:
Sorry about that should of clarified, I think they just wanted any labeling, noting specific.


I see why I was having trouble, the descriptions and names of the tar, more, and less commands do not sounds like they do what I want (at least to me) and had none of the keywords I was searching for.

Last edited by wisnoskij; 05-06-2010 at 07:48 AM.
 
Old 05-06-2010, 07:58 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
This does the specified (and it uses cat as you wanted at first and you can be a smartass and solve the problem without using the expected tools )
Code:
cat $( ls -1 | tee /dev/tty) > all_of_them
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find some files and concatenate them? yumener Linux - Newbie 7 03-10-2009 04:41 PM
concatenate files sorted by date docaia Programming 5 08-16-2008 09:32 PM
Script to concatenate several files docaia Linux - General 10 02-03-2008 02:59 PM
Concatenate PDF files? mykrob Linux - Software 5 11-07-2006 06:25 AM
concatenate binary files???? justin19fl Linux - Newbie 6 05-14-2001 03:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration