I have a log-file where at the end of a series of lines you can see if this block is relevant
now I'm looking for a command like sed to delete de blocks ending with "Content-Length: 0" and beginning with the last "--" before this line.
I tried sed -n "/--/,/Content-Length: 0/d" but this takes the first "--" and the first "Content-Length: 0" and deletes it.
ex :
line 1 "--"
line 2
line 3 "
Running below line gives 3957 as length of longest line in file 20121119_SRMNotes_init.dat
Code:
awk ' { if ( length > 3950 ) { x = length } }END{ print x }' 20121119_SRMNotes_init.dat
While wc -L 20121119_SRMNotes_init.dat gives output as 4329. Why is there a difference between these two commands.
Thanks
Hi,
I have a issue, I need to loop through a comma delimited file and check for the length which exceeds specified length , if Yes truncate the string.
But my problem is , I do not have to check for all the fields and the field lenght is not same for all the fields.
For ex:
Say my line
ahjdh,dfhkajhdf,adhklf,eiour
say I need to check length only for 2nd and 4th and max length for 2nd is 6
I would like to write a script that takes something like this:
Line 1
Line 2
Line 3
Line 4
[Blank line]
Line 6
Line 7
Line 8
Line 9
[Blank line]
etc....
And makes it to look like this:
Line 1|Line 2|Line 3|Line 4|[Blank line, if it's easier]
Line 6|Line 7|Line 8|Line 9|[Blank line, if it's easier]
etc.
I would think it would be fairly easy to use two loops, one for the the 5-li
Hello all ,
I have two files a.txt and b.txt which have same content . They contain data that is fetched from database through a java program. When I delete a line in a.txt and run the below command
comm -13 a.txt b.txt
I am not getting the expected result i.e. the line i deleted from a.txt. Instead i am getting the two lines i.e. the line I deleted and the line following it.
Hi,
Need help on the below topic.
I am looping finger command and trying to get each line content into a variable.
hiii alll
i wrote a prgm which would take position and strand from file 1 and tries to locate a string 250 characters ahead/before that position in anothe file (based on strand 0 or 1)
open my $fhConditions, "<", "1.txt" or die "Epic Fail: $!";
open my $fhCharacters, "<", "2.txt" or die "OMG Fail: $!";
my $length = 250;
while (my $
Add a line in a specific position with Linux
If you need to add a line to a file in Linux, and you need to add that line in a specific position of the file there is an easy solution, even if you need to do it to hundreds of thousands of files.
Consider this file:
line 1
line 2
line 4
As you can see we missed line 3, so to add it just execute this command:
sed '3iline 3'
Parts of the comm
Assume I have a big file, ~1k lines, and I need to delete the line after some pattern, lets call it: somePatern.
Conditions:
cannot be done by hand (no searching -- /somePattern, and/or manually moving down one line and deleting).
preferably a single liner.