10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear Specialists,
I have following data
1 1 2
2 2 3
3 3 6
4 3 4
5 4 9
6 5 11
7 6 7
and I would like to obtain data like below
1 1 2
2 2 3
4 3 4
7 6 7 (2 Replies)
Discussion started by: Ryan Kim
2 Replies
2. 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(getlinenumber).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... (2 Replies)
Discussion started by: learninguser235
2 Replies
3. 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
4. Shell Programming and Scripting
Hi guys,
is there a way to delete a line from a text file by providing a line number for the line I want to remove?
I work in ksh88...
Thanks a lot (3 Replies)
Discussion started by: aoussenko
3 Replies
5. 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
6. 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
7. Shell Programming and Scripting
Hi guys ,
I m writing a script to delete a line at particular location.
But i m unable to use variable for specifying line number.
for example.
sed -n '7!p' filename
works fine and deletes 7th line from my file
but
sed -n '$variable!p' filename
gives following error.
sed: -e... (12 Replies)
Discussion started by: pinga123
12 Replies
8. UNIX for Dummies Questions & Answers
Alright, I'm sure there's a more efficient way to do this... I'm not an expert by any means. What I'm trying to do is search a file for lines that match the two input words (first name, last name) in order to remove that line. The removal part is what I'm struggling with. Here is my code:
echo... (4 Replies)
Discussion started by: lazypeterson
4 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. UNIX for Advanced & Expert Users
Hai
I have a flat file which contains more than 6 crore lines or records. I want to delete only one line, using line number. For example I want to delete 414556 th line . How to do this using sed or awk command.
thanks (3 Replies)
Discussion started by: tkbharani
3 Replies