Search Results

Search: Posts Made By: vakharia Mahesh
2,199
Posted By pravin27
See the below code, $cat infilevoucher DOB ...
See the below code,
$cat infilevoucher DOB amount name type
====== ======= ======= ================== ===
37836452 1/13/1961 ...
2,361
Posted By Ygor
Try...$ cat file1 John 1234 BASIC ...
Try...$ cat file1
John 1234 BASIC 26000
John 1234 ALLOWC 01550
John 1234 INCER 01700
John 1234 REL 20000
Debi 2345 BASIC 29000
Debi 2345 ...
7,233
Posted By Scrutinizer
Hi Vakharia, you're welcome. In regular awks, RS...
Hi Vakharia, you're welcome. In regular awks, RS can only be one character. If more characters are used, the leftmost character gets used. GNU awk (gawk) allows RS to be a regular expression. Try:
...
7,233
Posted By Scrutinizer
Try: sed 's/AM/\n&/g' file or if you have GNU...
Try:
sed 's/AM/\n&/g' file
or if you have GNU sed:
sed 's/AM/\n&/2g' file
7,233
Posted By yinyuemi
try: awk 'NR>1{print "AM"$0}' RS="AM"...
try:
awk 'NR>1{print "AM"$0}' RS="AM" urfile
3,269
Posted By rdcwayx
awk -F"[:,]" ' NR==FNR{a[$2]=$1;next;} # (1)...
awk -F"[:,]" '
NR==FNR{a[$2]=$1;next;} # (1) It only builds array a for file2 (that's the first file in awk command) , NR==FNR is used to control it.
a[$3] # (2) then check if we have the same...
3,269
Posted By rdcwayx
To thank in this forum is, click the Thanks...
To thank in this forum is, click the Thanks Thumb.

a[$3] is used to build an array a in awk.
3,269
Posted By rdcwayx
some updates base on pravin27's code, to fix the...
some updates base on pravin27's code, to fix the problem if there are different spaces or tabs before and after city and country name.

awk -F"[:,]" '
function s(a) {gsub(/^[\t ]*/,"",a);gsub(/[\t...
3,269
Posted By pravin27
Try this, awk -F"[:,]"...
Try this,

awk -F"[:,]" 'NR==FNR{a[$2]=$1;next;} a[$3] { print $1,$2,$3,a[$3]}' file2 OFS="," file1
Showing results 1 to 9 of 9

 
All times are GMT -4. The time now is 03:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy