The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 04-14-2006
benair benair is offline
Registered User
  
 

Join Date: Apr 2006
Posts: 3
deleting a varying amount of lines from a list of files

I did search the posts for info on this and while there were some in the ballpark, none addressed this specifically. (also I tried to post this once it said I was logged out, so hopefully I'm not sending a duplicate here).

I have a set of files (250 +/-) where I need to delete the first "$x" number of lines and output what remains to a new file (or cat all the results into one file)

so far, I was able to piece together this much:

cat -n index20a6.html index3e43.html index6a84.html (...and so on) | grep
'<TITLE>Section 440.' | awk '{print $1}'

it results in this:

973
1722
2219
...

'<TITLE>Section 440.' is on a different line in each file so the amount of line to delete will vary.

The missing piece is to delete '1,973d' '1,1722d' '1,2219d' as it goes through and create a new file.

(also if I can go through this list recursively rather than list all the files in my command, that would be a bonus!)

Thanks for any assitance on this!