The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 08-22-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
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.