10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi,
I have a file where I need to change the date format on the nth field from DD-MM-YYYY to YYYY-MM-DD so I can accurately sort the record by dates
From regex - Use sed or awk to fix date format - Stack Overflow, I found an example using nawk.
Test run as below:
$: cat xyz.txt
A ... (2 Replies)
Discussion started by: newbie_01
2 Replies
2. Shell Programming and Scripting
Hi,
I need to set "prd" in the below command to a unix variable
nawk '/^#/ {next} FNR==NR {prd;next} !($0 in prd)'
So, this is what i did
fname=prd // unix shell variable
nawk -v fname=$fname '/^#/ {next} FNR==NR {fname;next} !($0 in fname)'But the value of fname i.e "prd" is not... (8 Replies)
Discussion started by: mohtashims
8 Replies
3. 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
4. Shell Programming and Scripting
Hi,
I'm trying to replace a string with the contents of a file.. I found the below thread that shows how to do this but is there any way to use a variable as the file name in the nawk command?.. When I try I get an error saying
while read groupsvar
do
... (5 Replies)
Discussion started by: Jazmania
5 Replies
5. Shell Programming and Scripting
I'm trying the following script using nawk and failed to call variable inside the script.
echo "Enter the absolute path of XML location for respective billcycle"
read xml_location
grep "string to find:" abcd.log|cut -d '/' -f12|nawk '{print $xml_location $1}' > redirected_log.log
Please... (2 Replies)
Discussion started by: nadvi
2 Replies
6. Solaris
Hi,
new to nawk so not sure how this works,
I have a file with three values 23:36:18 - i need to set a variable called SCORE with the highest value from the file (i.e. 36) using nawk
can anyone help?
thanks (1 Reply)
Discussion started by: Pablo_beezo
1 Replies
7. Shell Programming and Scripting
I am trying to make a simple script in which i take input from shell and then forward the value to
nawk (BEGIN).
but when i run below mention script so it give no output.
echo "Enter TRUNK GROUP:"
read TGR
cat /omp-data/logs/5etr/080422.APX | nawk -F"|" -v P=$TGR '
BEGIN {
TG=P;... (1 Reply)
Discussion started by: wakhan
1 Replies
8. UNIX for Dummies Questions & Answers
After searching through books and the internet for days I can't seem to find an example of this.
I'm trying to pass a variable from a for loop into nawk but can't seem to get all the syntax right.
my script (thanks to anbu23 for nawk help) is this:
for customers in `cat customers.txt`
do... (3 Replies)
Discussion started by: Ant1815
3 Replies
9. Shell Programming and Scripting
Dear friends,
please tell me how to pass the external variable values to the nawk command.
length=`expr $len2 - $len1`
i need to pass $length to following nawk command as mentioned below.
nawk '{if((x=index($0,"W/X"))>0){id=substr($0,x, $length);print x;print id;}}' filename1
but I am... (1 Reply)
Discussion started by: swamymns
1 Replies
10. UNIX for Dummies Questions & Answers
Hi I'm using bsch? on an OSX machine, how can I change privilges on an external volume? It is read only and I want it r+w. I can navigate to it, see it read it, but chmod won't do what I want. (1 Reply)
Discussion started by: andbro
1 Replies