10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Can someone please guide me how to combine the following two awk calls in one?
I noticed that it is very often situation for me, and I think that it can be replaced with one awk call.
The question is more general, not the exact one.
echo "A B C/D" | awk '{print $3}' | awk -F/ '{print... (4 Replies)
Discussion started by: mirusnet
4 Replies
2. Shell Programming and Scripting
HI
i have two files say test and test1
Test.txt
Code:
Lun01 2TB 1.99TB 99.6%
Lun02 2TB 1.99TB 99.5%
Lun03 2TB 1.99TB 99.5%
Lun04 2TB 1.55TB 89.6%
Code:
Test1.txt
Lun01 2TB 1.99TB 89.5%
Lun02 2TB 1.99TB 99.5%
Lun03 2TB 1.99TB 99.5%
Requirement is to compare... (6 Replies)
Discussion started by: venkitesh
6 Replies
3. Shell Programming and Scripting
my code:
gawk 'NR>'"${LASTLINENUM}"' && NR<='"${LINEENDNUM}"'' ${LOGFILE} | gawk '{l=$0;} /'"${STRING1}"'/ && /'"${STRING2}"'/ {for (i=NR-'"${BEFOREGLAF}"'; i<=NR+'"${AFTERGLAF}"'; i++) o=i; t++;} END { for(i=1; i<=NR; i++) if (o) print l; print t+=0;}'
i would like to combine this into one... (5 Replies)
Discussion started by: SkySmart
5 Replies
4. Shell Programming and Scripting
ignore the simplicity of the foo file, my actual file is much more hardcore but this should give you the jist of it. need to combine the two awks into one liner. essentially, need to return the value of one particular field in a file that has multiple comma separated fields. thanks guys
cat foo... (1 Reply)
Discussion started by: jack.bauer
1 Replies
5. Shell Programming and Scripting
Hi, everyone!
I have two files, I want to combine them as follows:
File1
AAAA 23 45
AAAB 44 56
AAAC 34 65
AAAD 34 87
File2
AAAA 34 54
AAAE 34 56
Combined file
AAAA 23 45 34 54
AAAB 44 56
AAAC 34 65
AAAD 34 87
AAAE 34 56 (13 Replies)
Discussion started by: xshang
13 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have the following two awk statements which I'd like to consolidate into one by piping the output from the first into the second awk statement (rather than having to write kat.txt out to a file and then reading back in).
awk 'BEGIN {FS=OFS=" "} {printf("%s ", $2);for (x=7; x<=10;... (3 Replies)
Discussion started by: kasan0
3 Replies
7. Shell Programming and Scripting
Hi Everyone,
awk 'BEGIN{print strftime("%c",1272814948)}' | tr -d '\n'
how to change tr -d '\n' to be part of the awk? means awk this pchoh time, and awk also remove '\n', instead of using "|" to combine "tr" command.
Thanks (2 Replies)
Discussion started by: jimmy_y
2 Replies
8. Shell Programming and Scripting
I have an awk statement that works but I am calling awk twice and I know there has to be a way to combine the two statements into one. The purpose is to pull out just the ip address from loopback1.
cat config.txt | nawk 'BEGIN {FS="\n"}{RS="!"}{if ( $0 ~ "interface loopback1" ) print$4}' | nawk... (5 Replies)
Discussion started by: numele
5 Replies
9. Shell Programming and Scripting
Within one of my awk scripts, I have three variables extracted and calculated on. When done, I simply want to combine the three. The following works, but looks weird. My script reads a field that has text and numbers, knowing the last four comprise MMYY (month and year)
# YY are last two... (2 Replies)
Discussion started by: joeyg
2 Replies
10. Shell Programming and Scripting
Hi,
I am interesting in writing the following bash codes into perl
My script is simple take field 2 in /etc/passwd and put into an array
#!/bin/bash
PASSWD_FILE=/etc/passwd
A=(`awk -F: ' { print $2 }' $PASSWD_FILE `)
Can someone give me equivalent codes in perl ? (1 Reply)
Discussion started by: phamp008
1 Replies