Search Results

Search: Posts Made By: pbluescript
1,241
Posted By Yoda
awk ' NR == 1 { p = $NF next;...
awk ' NR == 1 {
p = $NF
next;
} p == $NF {
if (($7 == "+") && (f <= $4))
v = $0
if (($7 == "-") && (f >= $4))
v = $0
} p != $NF...
4,571
Posted By Scrutinizer
Awk only: awk '{p=$2; getline<f} !A[$2=p $2]++'...
Awk only:
awk '{p=$2; getline<f} !A[$2=p $2]++' f=file2 file1
awk '{getline $1<f; $0=$0} !A[$2]++' OFS= f=file1 file2
4,571
Posted By itkamaraj
$ awk 'NR==FNR{a[$1]=$2;next}$1 in...
$ awk 'NR==FNR{a[$1]=$2;next}$1 in a{if(!b[a[$1]$2]++)printf("%s %s%s\n",$1,a[$1],$2);}' file1 file2
A:B:C 123456
D:E:F 234567
G:H:I 345678
M:N:O 456789
P:Q:R 567890
4,571
Posted By guruprasadpr
Hi $ join -1 1 -2 1 f1 f2 | awk...
Hi

$ join -1 1 -2 1 f1 f2 | awk '!a[$2$3]++{print $1,$2$3}'
A:B:C 123456
D:E:F 234567
G:H:I 345678
M:N:O 456789
P:Q:R 567890

Guru.
4,571
Posted By Scrutinizer
Try: paste file1 file2 | awk '!A[$2$4]++{print...
Try:
paste file1 file2 | awk '!A[$2$4]++{print $1,$2 $4}'
3,086
Posted By elixir_sinari
The problem is quite simple. You need to change...
The problem is quite simple. You need to change your awk program to the following one:

awk 'BEGIN{FS=OFS="\t"} {if($5-$4<=200) print $0; else if($5-$4>200) print $1,$2,$3,$4,$4+200,$6,$7,$8,$9}'...
5,929
Posted By Scrutinizer
Hi, that means: $2 in A { # If field 2 ($2)...
Hi, that means:
$2 in A { # If field 2 ($2) is a member of array A ( the field separator is a " for the second file)
$2=A[$2] # then replace $2 with the content of A[$2]
}
1 #...
5,929
Posted By Scrutinizer
Since file.txt is structured, you could also try:...
Since file.txt is structured, you could also try:
awk 'NR==FNR{A[$1]=$2;next} $2 in A{$2=A[$2]}1' FS=, conversion.csv FS=\" OFS=\" file.txt
For optimum results also try mawk instead of awk if that...
5,929
Posted By alister
Similar strategy, different tools. awk -F,...
Similar strategy, different tools.

awk -F, '{print "%s/\""$1"\"/\""$2"\"/g"} END {print "x"}' conversion.csv | ex -s file.txt

or using sed/echo to generate the ex commands:

{ sed 's#,#"/"#;...
5,929
Posted By hergp
You could try to use a sed command file. Write...
You could try to use a sed command file. Write all substitute-commands into one file and then call sed once, like:

while read LINE
do
OLD=$( echo $LINE | cut -d, -f1 )
NEW=$( echo $LINE |...
Showing results 1 to 10 of 10

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