03-18-2009
Sed options
I have a file with name input_file.spec.
This file has records like:
Record #: 1
rec_len = 590
rec_id = 31229
filler_4 = " "
orig_id = 902162988
seqnum = 138960799
lrnid = "0"
l_ind = "0"
transaction_cnt = 1
cust_id = 61032336
product_id = 135488621
ans so on.
It has 1000 records in this file.
I have to give new numbering to seqnum field only.
i am gogin to start with 1 and ll end with 1000.
I worte this:
#!/bin/ksh
i=1
echo "Give input file"
INPUTFILES=input_file.spec
cat $INPUTFILES | while read LINE
do
let i=i+1
sed -e '/seqnum/s/seqnum = [0-9]*/seqnum = '$i'/g' $LINE
done
but the "i" is not getting interpolated event when its reading line by line.
Can u please tell any option in unix to do the same.
or alternative to do the same business.
8 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello again,
Is there an option for the cp command to overwrite existing files in the destination directory?
Cheers
Rob (3 Replies)
Discussion started by: milage
3 Replies
2. Shell Programming and Scripting
Hi ..
Happy New Year..
If i do a
sed -e '
/BEGIN/,/END/{
h
/xxx/{
g
p
}
}
' temp1
I have two queries in this script
1.Will the block between BEGIN and END be stored in the hold buffer before executing the /xxx/ .. (9 Replies)
Discussion started by: sivasenthil_k
9 Replies
3. UNIX for Dummies Questions & Answers
I am just beginning to learn unix and I was wondering if there was a list of all the options somewhere on the net or hidden in the man pages?
Also do options always have - and then a letter, or can it be - and a number as well? Thanks! (1 Reply)
Discussion started by: terms5
1 Replies
4. AIX
Hi All,
I have a situation here that's very fun...
I have a system with AIX and iPlanet (sunOne) installed, when occurs an unknown event on the network the WebServer shows a thousand of CLOSE_WAIT connections and this number grows and grows until the webserver crashs.
I read some documents... (2 Replies)
Discussion started by: nascimento.rp
2 Replies
5. UNIX for Advanced & Expert Users
Hi Folks,
I am working on a data extraction script in perl.I am a begineer in perl and shell scripting. So i need your inputs to solve the script problem.
I have data coming from database in the format :-
<b> _ABC (Apply Changes) (p) </b> _EFG | HIJ | KLM | WER
<b> _E3R (Apply Changes)... (3 Replies)
Discussion started by: subhotech
3 Replies
6. Shell Programming and Scripting
Hi,
I have a script that, basically, has two input files of this type:
file1
key1=value1_1_1
key2=value1_2_1
key4=value1_4_1
...
file2
key2=value2_2_1
key2=value2_2_2
key3=value2_3_1
key4=value2_4_1
...
My files are 10k lines big each (approx).
The keys are strings that don't... (7 Replies)
Discussion started by: fzd
7 Replies
7. Ubuntu
Hello Everyone,
First of all, I highly appreciate all Linux forum members and whole Linux community. http://forums.linuxmint.com/images/smilies/icon_wink.gif. I wish you the best for all of you !
I will try to be short and concise: I am using Linux Mint 10 for 2 months on 2 ws, and all went... (3 Replies)
Discussion started by: cdt
3 Replies
8. Shell Programming and Scripting
Hi All,
I am having two files (file1 & file2) and a filelist.txt file below.
file1:
$$STRINGVAR1=5
$$STRINGVAR2=10
$$LAST_UPD_DT_TBL1=12/12/2010 12:00:00
$$STRINGVAR3=100
$$LAST_UPD_DT_TBL2=01/01/2010 12:00:00... (8 Replies)
Discussion started by: Chandru_Raj
8 Replies