I wrote a script to grep for a closing XML node. Then I need it to navigate up a line and insert some XML. Then go to the next occurrance. I have this
And I have the info I need now, except the actual insert part
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 75
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 149
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 228
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 300
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 364
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 428
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 518
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 569
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 644
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 709
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 782
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 861
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 912
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 985
[Insert] <QUANTITATIVE NAME="DB-BLODS" QUANT="1" /> at line 1058
...
---------- Post updated at 07:00 PM ---------- Previous update was at 06:55 PM ----------
I was reading up on awk, but now it looks like maybe I should use sed. Still reading the man file though.
---------- Post updated at 07:20 PM ---------- Previous update was at 07:00 PM ----------
Wow.... you learnt all about sed in 10 minutes.
That was pretty fast.
Again, if you want a solution, do this.
post what you have and what you need.
Example:
I get:
I want it as follows:
11111111 must come after bbb
Or may be
11111111 must come before ccc
Hi everyone :)
I have a file "words.txt" containing hundreds of lines of text. Each line contains a slogan.
Using the code below i am able to generate an image with the slogan text from each line.
The image filename is saved matching the last word on each line.
Example:
Line 1: We do... (2 Replies)
i am trying to
insert text at the beginning of every even number line
with awk
i can do it with odd number lines
with this command
awk 'NR%2{$0="some text "$0}1' filehow can i edit this command
thanks (5 Replies)
Hi All,
I am using UNix Sun OS sun4u sparc SUNW,SPARC-Enterprise
My intention is to insert a line of text after 13th line of every file inside a particular directory.
While trying to do it for a single file , i am using sed
sed '3 i this is the 4th line' filename
sed: command garbled: 3... (5 Replies)
I have a test file that I want to read and insert only certain lines into the
the table based on a filter.
1. Rread the log file 12 Hours back Getdate() -12 Hours
2. Extract the following information on for lines that say "DUMP is
complete"
A. Date
B. Database Name
C.... (2 Replies)
Hi,
I am new to unix. I need to insert a variable which contains some lines of text into a text file after fixed number of lines..
Please help me on this..
Thanks in Advance,
Amrutha (3 Replies)
My input file:
Class
Number Position Range
1 Initial 50
1 Initial 50
2 Terminal 150
2 Terminal 20
2 Single 10
3 Single 20
4 Double 50
5 Initial 50
5 Initial 60
Class
Number... (11 Replies)
I need to insert the output of a script into a specific line number of a txt file.
I've read the Sed man page and searched the forums and it's not immediately clear how I would go about doing this. (4 Replies)
Dear Folks :),
I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp.
I can do this in vi editor by using this command :g/^/s//BBB_
e,g I have a file named as Test.dat and it containins below text:
michal... (4 Replies)
Hi there,
may someone easily help me on this :
I want to insert a text in a specific line number like :
linenumb2start=`cat memory_map.dld | nl -ba | egrep -i "label" | cut -f1`
line2insert=`expr $linenumb2start + 2`
and now I need to replace something like {} with {comment} at... (8 Replies)
hi...
i have a file with data and would like to insert a number and bracket 1) ...2)
at the beginning of every successive line; to add some formatting to the text (3 Replies)