04-14-2006
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!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, I have the code below which outputs all the lines of a CSV file but I'd like it to only output 15 lines then save the current line as a variable which could be used (as a link) to display the next 15 lines. I can't get my head around the logic! Please help :D
while ($data = fgetcsv($fp,... (1 Reply)
Discussion started by: pondlife
1 Replies
2. Shell Programming and Scripting
I have written an script which will excluded some records from .csv file and put it on another excluded file from primary file.This is working very fine.Now the problem is that I want to delete those excluded lines from Primary file but not able to delete it.
I have stored the line number in... (1 Reply)
Discussion started by: 009satya
1 Replies
3. Shell Programming and Scripting
I have a directory full of text data files.
Unfortunately I need to get rid of the 7th and 8th line from them all so that I can input them into a GIS application.
I've used an awk script to do one at a time but due to the sheer number of files I need some kind of loop mechanism to automate... (3 Replies)
Discussion started by: vrms
3 Replies
4. UNIX for Dummies Questions & Answers
I have a directory full of text data files.
Unfortunately I need to get rid of the 7th and 8th line from them all so that I can input them into a GIS application.
I've used an awk script to do one at a time but due to the sheer number of files I need some kind of loop mechanism to automate... (3 Replies)
Discussion started by: vrms
3 Replies
5. UNIX for Dummies Questions & Answers
I need a little help...
I have a file with 3 fields,
Time/Date, IP address, UniqueID
I have a 2nd file of UniqueIDs.
I want to either (which ever is easier):
1. delete entries in file 1 that have a UniqueID in file 2
2. create a new file with the fields from File 1, excluding the... (4 Replies)
Discussion started by: goldie363
4 Replies
6. Shell Programming and Scripting
hi
i have a set of similar files. i want to delete lines until certain pattern appears in those files. for a single file the following command can be used but i want to do it for all the files at a time since the number is in thousands.
awk '/PATTERN/{i++}i' file (6 Replies)
Discussion started by: anurupa777
6 Replies
7. UNIX for Advanced & Expert Users
Is there a limit on the amount of lines less can handle? I grepped for something that is pretty common in my files so I tried to filter it through less so it was easier to look at. So I then used a redirect ">" to create a file. It created a file that was 103K long. So that makes me think there is... (6 Replies)
Discussion started by: cokedude
6 Replies
8. Shell Programming and Scripting
I have three files of varying lengths and different number of columns. How can I paste all three with all columns aligned?
File1
----
123
File2
----
234
345
678
File3
----
456
789
Output should look like:
123 234 456
345 789 (6 Replies)
Discussion started by: Un1xNewb1e
6 Replies
9. Shell Programming and Scripting
hello
I want to delete the lines of many files (e.g. file1, file2, ..., file1111) in my directory (e.g. dir1) that they have the 2nd column grater than a value (e.g. 40) placing them to a different directory (e.g. newdir) and keeping the originals. I wrote the code which is functional
awk '{... (3 Replies)
Discussion started by: phaethon
3 Replies
10. Shell Programming and Scripting
Hi, I have a large set of data (firewall logs) that I'm trying to summarize. I've been able to write a script to consolidate the ports, now am looking to conslidate even further, based on IP.
Source Destination Type Port
192.168.5.108 192.168.11.12 TCP 1, 2, 3, 4, 5, 15
192.168.5.109... (6 Replies)
Discussion started by: umang2382
6 Replies
LEARN ABOUT DEBIAN
ib_write_bw_postlist
ib_write_bw_postlist(1) User Commands ib_write_bw_postlist(1)
NAME
ib_write_bw_postlist - RDMA write post list bandwidth test
SYNOPSIS
ib_write_bw_postlist [ options ] [ server IP address ]
DESCRIPTION
This program tests the bandwidth of RMDA write transactions.
OPTIONS
-p, --port=<port>
listen on/connect to port <port> (default 18515)
-d, --ib-dev=<dev>
use IB device <dev> (default first device found)
-i, --ib-port=<port>
use port <port> of IB device (default 1)
-c, --connection=<RC/UC>
connection type RC/UC (default RC)
-m, --mtu=<mtu>
mtu size (256 - 4096. default for hermon is 2048)
-g, --post=<num of posts>
number of posts for each qp in the chain (default tx_depth)
-q, --qp=<num of qp's>
Num of qp's(default 1)
-s, --size=<size>
size of message to exchange (default 65536)
-a, --all
Run sizes from 2 till 2^23
-t, --tx-depth=<dep>
size of tx queue (default 100)
-n, --iters=<iters>
number of exchanges (at least 2, default 5000)
-I, --inline_size=<size>
max size of message to be sent in inline mode (default 400)
-b, --bidirectional
measure bidirectional bandwidth (default unidirectional)
-V, --version
display version number
-F, --CPU-freq
do not fail even if cpufreq_ondemand module is loaded
AUTHOR
Guy Coates < gmpc@sanger.ac.uk >
perftest February 20, 2008 ib_write_bw_postlist(1)