4

Using AWK: Extract data from multiple files and output to multiple new files

view full story
linux-howto

http://www.unix.com – Hi, I'd like to process multiple files. For example: file1.txt file2.txt file3.txt Each file contains several lines of data. I want to extract a piece of data and output it to a new file. file1.txt ----> newfile1.txt file2.txt ----> newfile2.txt file3.txt ----> newfile3.txt Here is an example of what an input file and an output file could look like: file1.txt --------- line1 line2 line3 newfile1.txt ------------ line2 So, in this case, the awk script would extract line2 from each input file. That part is ok. I need to know how to create the multiple output files which contain (HowTos)