Dear Rudic,
Could you please teach me how to catch the fish.
I looked up sed -help before opening this thread, but there was no info regarding n and p and other letters.
I'd appreciate if you would let us know how to find more info regarding functions of this notations
My wisdom comes from the man pages: man sed, plus, infrequently, info sed.
And, DON'T forget, regular consumption of these fora! Many a trick I learned in here. Above little one copies a line into the hold buffer (h), reads the next line (n), appends from the hold buffer (G), and prints (p). It depends on the lines always coming in pairs.
If, instead of switching every pair of lines in a file, you wanted to switch every line containing the string wget with the line preceding it, you could try:
And, if after switching the order of those pairs of lines you also want to join them, you could try:
or, if as in this example, you don't need to perform any parameter expansions in the here-document:
This User Gave Thanks to Don Cragun For This Post:
Hello,
I have a file with thousands of rows and I need to change sequence of lines.
Sample file:
#NAME
#SERVICE 112233
#DESCRIPTION AABBCCDD
#SERVICE 738292
#DESCRIPTION FFYYRRTT
...
...
...
Desired output:
#NAME (5 Replies)
Hi All
I have a file like this:
ID1 ref_A 10 ref_B 30 ref_C 5
ID2 ref_F 69 ref_G 12 ref_H 5
Every ID is followed by a string(ref_X) followed by a number(every number is referred to the previous ref)
I would like to order the file like this(the column could be more, but always with the same... (4 Replies)
this is the requirement
list.txt
table1
table2
table3
testfile.txt
name#place#data#select * from table1
name2#place2#data2#select * from table 10 innerjoin table3
name2#place2#data2#select * from table 10
output
name place table1
name2 place table3
i tried using awk (7 Replies)
Hi. How can I read row number from one file and print that corresponding record present at that row in another file.
eg
file1
1
3
5
7
9
file2
11111
22222
33333
44444
55555
66666
77777
88888
99999 (3 Replies)
Hi Friends,
I have a single column data like below.
1
2
3
4
5
I need the output like below.
0
1
2
3
4
where each row (including first row) subtracting from first row and the result should print below like the way shown in output file.
Thanks
Sid (11 Replies)
i need a script that reads a wwn file like this:
LOCAL_HOST (before)
50:01:24:82:00:6c:a9:04
21:00:00:24:ff:30:35:7b
21:00:00:24:ff:30:35:70and will run over the file with all the wwn's in the same row in order to create zones on a switch
like so:
LOCAL_HOST (after)
zonecreate " (... (2 Replies)
Dear masters,
I stuck again in a very tricky situation,so need your valuable inputs. I have a file having rows as below:
_Db
_Database 1023 1 1 1 17.0B 0.2 1.0
_Field
_Field-Name 3 2 2 11 56.2K 64.1 ... (5 Replies)
hi guys, today i'm stuck in a new problem.
the title explain more or less but a particular had been omitted. So i'm going to describe below the situation with an example.
I have different html files and each of them have a consecutive lines group inside that i want to extract.
example:
... (8 Replies)
Hi
I want to append line 2n to 2n-1 line where n=1...LastLine in my file.
eg:
Actual File:
Hello
Everyone
Welcome
TO Unix
I need
Your help
Required File:
HelloEveryone
WelcomeTO Unix
I needYour help (5 Replies)
Hi,
I want to write a shell script which increments a particular column in a row from a text file and then adds another row below the current row with the incremented value .
For Eg .
if the input file has a row :
abc xyz lmn 89 lm nk o p
I would like the script to create something like... (9 Replies)