10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a file that has 2 fields called b_file:
11977 DAR.V3.20150209.1.CSV
3295 DAR.V3.20150209.1.CSV
1721 DAR.V2.20150210.1.CSV
I need to search a sftplog using the field 1, but want to maintain the relationship between field 1 and 2. I am passing field 1 as a parameter in a bash loop.
... (14 Replies)
Discussion started by: smenago
14 Replies
2. Shell Programming and Scripting
Hi.. i am running nawk scripts on solaris system to get records of file1 not in file2 and find duplicate records in a while with the following scripts -compare
nawk 'NR==FNR{a++;next;} !a {print"line"FNR $0}' file1 file2duplicate - nawk '{a++}END{for(i in a){if(a-1)print i,a}}' file1in the middle... (12 Replies)
Discussion started by: Abhiraj Singh
12 Replies
3. 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
4. Shell Programming and Scripting
I am trying to figure out a way in nawk to 1) get a count of the number of times a value appears in field 1 and 2) count each time the same value appears in field 2 for each value of field 1. So for example, if I have a text file with the following:
grapes, purple
apples, green
squash, yellow... (2 Replies)
Discussion started by: he204035
2 Replies
5. 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
6. Shell Programming and Scripting
I use this command to find a search (Nr of active alarms are) and print one line before and 10 lines after the search keywords.
nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r;print;c=a}b{r=$0}' b=1 a=10 s="Nr of active alarms are:" *.log
However, I would like to know how to tell it to print... (3 Replies)
Discussion started by: tthach830
3 Replies
7. Shell Programming and Scripting
Good Morning/Afternoon All,
I am having some trouble creating a variable called "total" to display the sum of the values in a specific field, $6 for example.
The data I am working on is in the following form:
John Doe:(555) 555-5555:1:2:3
Jane Doe:(544) 444-5556:4:5:6
Moe Doe:(654)... (2 Replies)
Discussion started by: SEinT
2 Replies
8. Shell Programming and Scripting
Hi,
I would like to clarify about the NAWK array to store multiple lines from huge file.
The file is having an unique REF.NO, I wants to store the lines (it may be
100+ lines) till I found the new REF.NO.
How can I apply NAWK - arrays for the above?
Rgds,
sharif. (1 Reply)
Discussion started by: sharif
1 Replies
9. UNIX for Dummies Questions & Answers
This is a derivative of a question I asked earlier, but I can't figure out how to make all of the pieces work (mainly the array piece).
How do I get the following data set:
aaa|bbb|ccc|123|ddd...
abc|def|ghi|123|jkm...
aaa|bbb|ccc|456|ddd...
abc|def|ghi|456|jkm...
aaa|bbb|ccc|789|ddd...... (4 Replies)
Discussion started by: clueless181
4 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