10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi guys,
Hope someone can help me with this - I'm sure it's fairly simple but it's driving me mad! (forgive the coding - still new on scripting - come from Windows)
I have the following coding for checking whether I want to include a line in a file:-
EXTRACT_Date=$(date --date="${PERIOD}"... (6 Replies)
Discussion started by: NickF
6 Replies
2. Shell Programming and Scripting
Hello Friends,
I am new to unix shell, need to understand the meaning of few cmds in below script,
#!/usr/bin/ksh
FTP_FILE_NAME="$1"
if
then
grep "TRLR@@@@@@" $FTP_FILE_NAME | nawk -F"" '{print $2}'
else
echo "0"
fi
what is the use of -r, grep, nawk & -F in above script. Why... (2 Replies)
Discussion started by: DK2014
2 Replies
3. 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
4. Shell Programming and Scripting
Hi,
I'm trying to reformat some badly formatted XML that I've extracted from Oracle clob columns using the following nawk command:
nawk '{gsub(/</,/>\n/); print}' test.raw > test.xml
the substitution executes fine, but instead of subbing < with > followed by newline, it subs the < with a... (3 Replies)
Discussion started by: sffuji
3 Replies
5. Shell Programming and Scripting
#ifconfig -a | nawk '/1.1.1.1/{print}'
inet 1.1.1.1 netmask xxxxxxxxx broadcast 0.0.0.0
If i assign the ip to a variable and search for the variable nothing gets printed!!
# ifconfig -a | nawk -v ip=1.1.1.1 '/ip/{print}'
I am not able to understand why this is happening! (6 Replies)
Discussion started by: chidori
6 Replies
6. Shell Programming and Scripting
Hi,
Below work fine, whenever any character puts, however if we use "(", it's not working.
Working
===============
echo 'Sau(rabh is Nice' | nawk -v a="Saurabh" '{print substr($1,1,match($1, "u"))}'
Not working
====================
echo 'Sau(rabh is Nice' | nawk -v a="Saurabh" '{print... (3 Replies)
Discussion started by: sbaisakh
3 Replies
7. Shell Programming and Scripting
Hi All,
I am seeing an issue while using toupper in nawk. Below is the code that I am using.Toupper method is not working as expected in this case.nawk 'NR==FNR{a=$4" "$5}NR>FNR{print NF?$0:a"\n";if(/^cn:/) x=toupper($0)}' FS="" id_list.txt attributes.txt > out
In the above script, id_list... (9 Replies)
Discussion started by: Samingla
9 Replies
8. Shell Programming and Scripting
I have 2 files:
File1
"aa","server","001-9031234-001",
File2
001-9031234-001|12345
Both files have many lines of text. Each line needs to be evaluated. I need to look at the value of the third field in File 1. Then look for that same value in File 2 and assign the value of Field 2... (5 Replies)
Discussion started by: scriptr2be
5 Replies
9. UNIX for Dummies Questions & Answers
Can any one please say about the below,
using,
grep -v "name" file.txt
the result of above command will be it will print all the lines except the line which having the word "name"
similarly,
nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r;print;c=a}b{r=$0}' b=0 a=1 s="name" file.txt
... (7 Replies)
Discussion started by: prsam
7 Replies
10. 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