![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| read list of filenames from text file and remove these files in multiple directories | fxvisions | Shell Programming and Scripting | 5 | 08-07-2008 04:59 PM |
| grep on multiple words to match text template | rider29 | Shell Programming and Scripting | 6 | 05-23-2008 12:21 PM |
| Replace text in multiple files | on9west | Shell Programming and Scripting | 1 | 05-20-2008 02:35 AM |
| deleting lines from multiple text files | vrms | Shell Programming and Scripting | 3 | 04-25-2008 12:01 PM |
| Replace text in multiple files | Tonka52 | Shell Programming and Scripting | 10 | 03-24-2008 08:11 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
How do I use the grep command to take mutiple text files in a folder and make one huge text file out of them. I'm using Mac OS X and can not find a text tool that does it so I figured I'd resort to the BSD Unix CLI for a solution... there are 5,300 files that I want to write to one huge file so that I can import it into a database in one shot... any help would be geratly appreciated. Thanx.
|
|
|||||
|
Wow - I tried
(ls * | xargs cat) > all It works the same and it's cool that it's so small.. but I keep getting the error: cat: input/output files 'all' identical The large file is created like it should be, but is there something additional to get rid of / suppress this error? |
|
||||
|
error messages
the error message doesn't meen anything however if there are a lot of files in the folder it can be annoying to get all of those messages
you can get rid of those error messages by sending them to another file. the command ls * | xargs cat > all 2> /dev/null works on my system (Sun,solaris) it may work on yours also |
|
|||||
|
Quote:
(ls | xargs cat) > all I also didn't think about the output file popping into existence before the ls ran. The best solution for that is something like: (ls | xargs cat) > /some/dir/all cat is smart enough to catch this, but grep isn't. And I'm still thinking that the op wanted to use grep to extract certain lines. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|