In this file , 3 consecutive lines look same for a@,b@,c@ d@
If in the 2nd column of 2nd row of every such segment contains (, then I have to append 'new' after the 5th column
of the 1st line of that segment such that the next word of the appended word stayed in the previous position.
Like if the c segment looks like [2nd column of 2nd row contains ')' ]
Then 5th column of the 1st line of that segment should look like
So new file should look like
Please let me know if I can do the change by Unix bash shell scripting
Thank you for your reply .
In the above code, newly appended word 'c000000new' shifts the next word 'c00' from it's position.
But the next word should not move from it's previous position
Can I use the same logic using bash script.I have to use bash in my coding
Greetings all,
I am looking for a version of Linux that I can practice my scripting skills on. Currently, I support a massive system running on AIX. I want to do more with awk, sed, grep, and even perl. I am looking for something I can throw on a VM on my personal laptop and mess around with.... (5 Replies)
Hi folks,
I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex.
I have a bunch of update statements with all columns in a file which I need to convert into insert statements.
UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Dear All,
The row_eff_tmstp (4th field) and row_expr_tmstp(5th field) in below data represents. If row_expr_tmstp is less than row_eff_tmstp I should replace that as null. First record is header record.
I/P
------
DD04 DD040001 DD040001 NO NO NONE ... (1 Reply)
Hi,
I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :-
./sample.sh: line... (12 Replies)
Hi All,
I am new to unix.
In this forum some days back, I have read something like below:
1) Do not use perl if awk can do your work.
2) Do not use awk if sed can do your work.
.
.
.
I do not re-collect the whole thing. I think it is good to know the precedence of using these... (2 Replies)
I need to add a field at the beginning of each record in the file. The file is comma seperated. Can somebody throw some light.
My record looks something like this
I need to add 100 at the beginning of each record.
o/p should be (2 Replies)
i need a sample unix awk/sed program to replace param3 in a file.
i have sample file a.dat with the following format/length (week 8, sku 20, store 20 and qty 8). all store id's which end with _2 needs to be replaced with div id 2. all store id's which end with _1 needs to be replaced with div id... (4 Replies)
Hey all,
Can I put sed command inside the awk action ?? If not then can i do grep in the awk action ??
For ex:
awk '$1=="174" { ppid=($2) ; sed -n '/$ppid/p' tempfind.txt ; }' tempfind.txt
Assume: 174 is string.
Assume: tempfind.txt is used for awk and sed both.
tempfind.txt... (11 Replies)