The UNIX and Linux Forums
>
Top Forums
>
UNIX for Dummies Questions & Answers
grep multiple text files in folder into 1 text file?
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
grep multiple text files in folder into 1 text file?
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
3
(
permalink
)
08-22-2002
Perderabo
Unix Daemon
Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
With 5,300 files, the `ls *` will probably exceed the max line length and pg is a slow way to cat a file.
Code:
#! /usr/bin/ksh ls | while read filename ; do cat $filename done > all exit 0
will work. If the xargs program is available,
(ls * | xargs cat ) > all
will be a very fast solution.
I also wonder about the mention of grep. If you need to extract certain lines switch "cat" with "grep string" in both solutions.
Perderabo
View Public Profile
Find all posts by Perderabo
Find Perderabo's past nominations received
Find Perderabo's present nominations given