Search Results

Search: Posts Made By: manigrover
3,060
Posted By raj_saini20
try this (copy in file and run) awk ' ...
try this (copy in file and run)



awk '
NR==FNR&&NF>1{
x=$1;
for(i=2;i<NF;i++)
{
x=substr(x,1)":"substr($i,1);
};
a[x]=$NF
}
(NR!=FNR&&NF>1){
x=$1;...
1,277
Posted By balajesuri
In the same order as it appears in the inputfile:...
In the same order as it appears in the inputfile:

perl -lne 'chomp; if(!defined $x{$_}){$x{$_}=1;print}' inputfile
1,277
Posted By itkamaraj
sort -u filename.txt
sort -u filename.txt
1,277
Posted By itkamaraj
awk '!a[$0]++' input.txt
awk '!a[$0]++' input.txt
1,277
Posted By jayan_jay
one more in awk. $ awk '!($0 in a)...
one more in awk.

$ awk '!($0 in a) {a[$0];print}' infile
2,558
Posted By Don Cragun
The way I understand what was desired, the text...
The way I understand what was desired, the text in the last field ("Approved", "Discontinued", "Phase II", etc.) should appear in the output files rather than putting "Approved" in that spot no...
2,105
Posted By Don Cragun
The output produced by the script I supplied in...
The output produced by the script I supplied in message #3 in this thread is:
AST3 it is used in diabetes
GSTY4 it is used in diabetes
JST3 it is never applied in oedema
The output you said you...
2,105
Posted By Don Cragun
If you don't mind getting rid of all of the...
If you don't mind getting rid of all of the whitespace between the 1st and 2nd fields in your second file when writing the output:
awk 'FNR==NR {wanted[NR] = $1; next}
{ nf=split($1, f1, ",")...
1,735
Posted By raj_saini20
please provide the data for which output is not...
please provide the data for which output is not coming correctly

---------- Post updated at 10:18 AM ---------- Previous update was at 10:13 AM ----------

Also try this i made silly mistake in...
4,259
Posted By elixir_sinari
awk '{gsub(/\t/,"_")}1' file Or tr '\t' '_' <...
awk '{gsub(/\t/,"_")}1' file
Or
tr '\t' '_' < file
Or
sed 'y/[Tab]/_/' file

Use the Tab key in place of [Tab].
3,060
Posted By rangarasan
awk
Hi,

Try this one,

awk 'FNR==NR{a[$1]=$2;next;}{if($1 ~ /,/){split($1,b,",");for(i in b){if(a[i]){print i,$2,$3,a[i];}}}else{if(a[$1]){print $0,a[$1];}}}' file2 file1

Again i assuming...
4,407
Posted By shitson
Yep as i thought, it's tab delimited :)
Yep as i thought, it's tab delimited :)
Showing results 1 to 12 of 12

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