Skip to content

Latest commit

 

History

History
7 lines (4 loc) · 614 Bytes

File metadata and controls

7 lines (4 loc) · 614 Bytes

Extracting Specific Lines from Files

(1) Try writing a Bash script to extract only the 30th line from all the .txt files in a folder, and make a new file that stores these lines.

(2) Let's say you have a series of files that all start with one header line at the top (containing column labels). You'd like to keep the header lines and all lines except the first 10 after the header. Try writing a script to do this. You will probably want to use head, tail, |, and wc.

You can make up your own example files to test your solutions for these problems, but we can also provide them if you'd prefer.