10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi ,
i have a file with data as below.This is same file. But actual file contains to many rows.
i want to search for a string "Field 039 00" and delete that line and previous 3 lines in that file.. Can some body suggested me how can i do using either sed or awk command ?
Field 004... (7 Replies)
Discussion started by: vadlamudy
7 Replies
2. Shell Programming and Scripting
Hi,
I am writing a script to split a log file - the log could contain multiple days worth of logs. The second line of the log contains the string "Version ". In my test log which comprises of two days worth of logs, this string appears twice - once each day.
Essentially I would like to split... (7 Replies)
Discussion started by: pmurray21
7 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I have written a script that returns the line number of the pattern i want and i stored the line number in a variable.Now i want to delete all the lines in a file above this line number which is stored in a variable.
i am using sed '1,$getlinenumberd' > file1.txt which is not working(wrog... (5 Replies)
Discussion started by: learninguser235
5 Replies
4. Shell Programming and Scripting
Hi
What I'm trying to do is delete every blank line upto a certain number, so for instance I only want to delete the first 4 empty lines within a file, I know how to delete every line with:
sed '/^$/d'
But I can't figure out how to limit it to only the first 4 occourances
I though it... (5 Replies)
Discussion started by: duonut
5 Replies
5. Shell Programming and Scripting
Hi
I am using the following command to delete a line from the file by line number:
line_number=14
sed "${line_number}d" inputfilename > newfilename
Is there a way to modify this command to specify the range of lines to be deleted, lets say from line 14 till line 5 ?
I tried using the... (5 Replies)
Discussion started by: aoussenko
5 Replies
6. Shell Programming and Scripting
I have a file with ~200K lines, I need to delete 4K lines in it. There is no range.
I do have the line numbers of the lines which I want to be deleted.
I did tried using
> cat del.lines
sed '510d;12d;219d;......;3999d' file
> source del.lines
Word too long.
I even tried... (2 Replies)
Discussion started by: novice_man
2 Replies
7. Shell Programming and Scripting
I have file with 10000 records and i need to delete the lines in single shot based on line number range say from 10 to 51 , 53 to 59 , 105 to 107, 311 to 592 etc... between range works fine for me but how to achive for above case? please help
sed '10,51 {d}' infile > outfile (5 Replies)
Discussion started by: zooby
5 Replies
8. Shell Programming and Scripting
Hello !
I am trying to delete a number from the even-numbered lines of a pipeline after having extracted and sorted the desired data from an original text file using sed...
sed -r 's/\(*\)*\((*)\),*,*,(*)*: * \w*\=(*).*/\3,\1/g' | sort -n
then the data looks like :
Now, I am... (3 Replies)
Discussion started by: ShellBeginner
3 Replies
9. UNIX for Dummies Questions & Answers
I have been googling, but cannot find that works for me.
I have a text file tmp.out with contents:
sadfsdf sdfosuidhfousdhof soduhf osdfu osudfhosudhfd
sdfgsdfg
asdfiojhsdf asdoludhflsdjfhskldjfhsdjdlfsjdhnlj h sdja
ouahsdjdafkljsa
oljhljh
I have another file... (11 Replies)
Discussion started by: ChicagoBlues
11 Replies
10. Shell Programming and Scripting
Hello, I need help in appending the line number of each line to the file and also to get the total number of lines. Can somebody please help me.
I have a file say:
abc
def
ccc
ddd
ffff
The output should be:
Instance1=abc
Instance2=def
Instance3=ccc
Instance4=ddd
Instance5=ffff
... (2 Replies)
Discussion started by: chiru_h
2 Replies