10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
nawk '{ fmt="%3s %22s %48s %35s %21s\n"; if ($3==$6 && $1=="STOPLOSS") { tpy="Successful Match"; jnme=$1; sts="File will be loaded"; cntrl=$3; audit=$6; printf (fmt, tpy,jnme,sts,cntrl,audit) >> "'${AUDIT_DATA_FILE}/${AUDIT36}'" }else if ($3!=$6 && $1=="STOPLOSS") { tpy="Mis-Match ";... (4 Replies)
Discussion started by: wawa
4 Replies
2. Shell Programming and Scripting
I am trying to redirect record to two files using nawk if-else.
#Identify good and bad records and redirect records using if-then-else
nawk -F"|" '{if(NF!=14){printf("%s\n",$0) >> "$fn"_bad_data}else{printf("%s\n",$0) >> $fn}}' "$fn".orig
"$fn".orig is the source file name
bad... (7 Replies)
Discussion started by: siteregsam
7 Replies
3. Shell Programming and Scripting
Hi,
Could you please tell me how nawk command works when there is a asterisk <*> or space with asterisk < *> or <* > in the parameter.
I am just trying to read line by line and fetch fourth parameter separated by delimiter (|).
But if there is a * or < *> or <* > in the fourth parameter it... (7 Replies)
Discussion started by: nram_krishna@ya
7 Replies
4. Shell Programming and Scripting
HI,
My file contains data something like
034500,5,B5004946544EB185,DEFAULT,0
Now i want to do a pettern match for DEFAULT and remove that particular line from file and transfer the rest contents to temp file.But my req is i want to do case insensitive matching ie DEFAULT / default.
I... (4 Replies)
Discussion started by: centurion_13
4 Replies
5. Shell Programming and Scripting
help out with code. two files aaa bbb contains some records..output file xyz should be like this..see below
i/p file:aaa
08350|60521|0000|505|0000|1555|000|NYCMT|Pd_1 |-11878
i/p file: bbb
60521|60510
o/p file :xyz
60510|08350|60521|0000|505|0000|1555|000|NYCMT|Pd_1 |-11878 (5 Replies)
Discussion started by: Diddy
5 Replies
6. Shell Programming and Scripting
hi people;
this is my two awk code:
nawk '/cell+-/{r=(NF==8) ? $4FS$5FS$6 : NF==7 ? $4FS$5 : $4 ;c=split(r,rr);for (i=1;i<=c;i++){if(rr != "111111"){printf($3" %d ""\n",(i+3))}}printf("")}' /home/gc_sw/str.txt > /home/gc_sw/predwn.txt
nawk -F'*' '{gsub(/ *$/,"")}$0=$1$($NF-2)'... (2 Replies)
Discussion started by: gc_sw
2 Replies
7. Shell Programming and Scripting
I HAD these 2 files:
file1
pictures.txt 5 ref2313 4 ref2345 3 ref5432 2 ref4244 1
dance.txt 6 ref2342 5 ref2352 4 ref0695 3 ref5738 2 ref4948 1
treehouse.txt 6 ref8573 5 ref3284 4 ref5838 3 ref4738 2 ref4573 1
file2
pictures.txt 1 3
dance.txt 2 4
treehouse.txt 3 5
what I... (1 Reply)
Discussion started by: linuxkid
1 Replies
8. Shell Programming and Scripting
I have a file tmp.txt as shown below:
Controller: 0
Disk: 0.0.0
Disk: 0.1.0
Disk: 0.2.0
Controller: 1
Volume:c1t2d0
Disk: 0.0.0
Disk: 0.1.0
Disk: 0.2.0
Controller: 2
Volume:c2t2d0
Disk: 0.2.0
Now I want to split... (4 Replies)
Discussion started by: durbam2002
4 Replies
9. Shell Programming and Scripting
i'm new to shell scripting and have a problem please help me
in the script i have a nawk block which has a variable count
nawk{
.
.
.
count=count+1
print count
}
now i want to access the value of the count variable outside the awk block,like..
s=`expr count / m`
(m is... (5 Replies)
Discussion started by: saniya
5 Replies
10. Shell Programming and Scripting
How are ya,
Heres the problem.
I have a line of data that can either be in this format.
"20" or
"20kg"
for the 20kg one i need to be able to read that their is kg on the end of this field and then ignore it and move on to the next line. Can anyone help.
Cheers (3 Replies)
Discussion started by: ben_shark
3 Replies