Search Results

Search: Posts Made By: pamu
2,516
Posted By pamu
Then try my solution :)
Then try my solution :)
2,516
Posted By pamu
Try $ awk -F, 'BEGIN{print "record_number ,...
Try

$ awk -F, 'BEGIN{print "record_number , columns_with_diff"}
NR==FNR{for(i=2;i<=NF;i++){A[$1,i]=$i}next}{for(i=2;i<=NF;i++){if($i!=A[$1,i]){p=p?p","i:i}}print $1,p;p=""}' file1 file2...
4,120
Posted By pamu
OR $ awk -F , '!$4{$4="BIKE"}1' OFS=","...
OR

$ awk -F , '!$4{$4="BIKE"}1' OFS="," file

1,abc,55,CAR
3,bb,dd,CAR
5,ddd,tttt,BIKE
8,ee,55,BIKE
1,953
Posted By pamu
awk 'NR==FNR{A[$3]++;next}{if(A[$3] > 1 &&...
awk 'NR==FNR{A[$3]++;next}{if(A[$3] > 1 && !B[$3]){B[$3]++;next} }1' file file

12 NIL ABD LON
12 NIL ABC AMR
13 NIL ABC AMR
11 NIL ABK AMR
1,562
Posted By pamu
modified your code try key="phani;ravi;kiran"...
modified your code
try
key="phani;ravi;kiran"
number_of_keys=$(echo $key|awk '{print NF}' FS=';')
for (( i = 1; i <= $number_of_keys; i++ ));
do
key=$(echo $KEY_TO_COMPARE|awk -v var=i 'BEGIN {...
2,387
Posted By pamu
With some assumptions.. $ awk -F ">" '{...
With some assumptions..

$ awk -F ">" '{ print $NF}' file

96427210 861521305 123257583
79634223 861521305 79634223
68404733 861521305 68422718
17,459
Posted By pamu
if you have date -d option $ date -d...
if you have date -d option

$ date -d "12/03/2013 11:02 AM" +"%d-%b-%Y %R %p"

03-Dec-2013 11:02 AM
1,248
Posted By pamu
Try sort -t- -nk3 -k2M -nk1 file
Try

sort -t- -nk3 -k2M -nk1 file
1,590
Posted By pamu
try $ awk -F "'" '/^:4488:/{F=1} /^-\}/{F=0}...
try

$ awk -F "'" '/^:4488:/{F=1} /^-\}/{F=0} F{gsub(/[{},]/,"");gsub(FS,"")}1 ! F{print}' file

:2020:WITCH13288008772
:4488:20131015INR25000003
:5500:00000060020001752
Mr. Chintan
Add1
. ...
4,628
Posted By pamu
with awk $ awk 'NR==FNR{A[$1]++;next}{if(!...
with awk

$ awk 'NR==FNR{A[$1]++;next}{if(! A[$1]){print }else{A[$1]=0}}END{for(i in A){if(A[i]){print i}}}' file1 file2

101214700333
101214100500
6,226
Posted By pamu
No I have given same file as input two times...
No I have given same file as input two times that's why it is file file and not file > file

If you want to redirect your output to any other file then do like this file file > file_out
7,793
Posted By pamu
also while read line do ...
also


while read line
do
wardevent=$(expr $line + 0) # remove leading Zero from the line
echo $wardevent
done<file
10,639
Posted By pamu
$ awk 'NR==FNR{a+=$2;next}{print $1"/"a}' file...
$ awk 'NR==FNR{a+=$2;next}{print $1"/"a}' file file
1/5
2/5
3/5
4/5
2,234
Posted By pamu
Sorry I've missed few steps. now try ...
Sorry I've missed few steps.

now try

awk 'NR==1{S=strtonum( "0x" $1 );P=$1}
NR>1{K=strtonum( "0x" $1 );if((K - S) == 1){S=K;T=$1}else{print P":"T;P=$1;S=K}}
END{if(T==$1 &&...
1,087
Posted By pamu
If should have space between brackets... can...
If should have space between brackets...
can reduce one grep
and avoid use of back tick's

try

x=$(ps -fu myuserid| grep -v grep | awk '/java/{print $2}')

if [ $x -eq 0 ]
2,081
Posted By pamu
awk 'FNR==NR{A[NR]=$0;next}{print A[FNR]""$0}'...
awk 'FNR==NR{A[NR]=$0;next}{print A[FNR]""$0}' top_list.txt_temp_1 top_list.txt_temp
1,364
Posted By pamu
awk '{for(i=1;i<=NF;i++){if(!A[$i,NR]++){S=S?S...
awk '{for(i=1;i<=NF;i++){if(!A[$i,NR]++){S=S?S OFS $i:$i}}print S;S=""}' OFS="\t" file

ID source
1 GM GF
2 GM GF
3 GM GF SF
4 FF
5 FF ...
1,168
Posted By pamu
Try awk '/TAG/{a++;next} {print > "File"a}'...
Try

awk '/TAG/{a++;next} {print > "File"a}' file
1,491
Posted By pamu
Then remove one OFS from awk code awk...
Then remove one OFS from awk code

awk 'NR==1{$1=OFS $1}1 NR>1{S=$1;for(i=2;i<=NF;i++){if($i != $1){S=S OFS $i}}print S;}' OFS="\t" file > file.out
6,895
Posted By pamu
awk -F ";" '{for(i=1;i<=NF;i++){if($i ~...
awk -F ";" '{for(i=1;i<=NF;i++){if($i ~ /chr|start|stop|symbol|gene_name|protein_name|info/){s=s?s";"$i:$i}}print s;s=""}' file
1,074
Posted By pamu
Please use code tags for code and data sample. ...
Please use code tags for code and data sample.

try

awk '{ print $1}' file
3,249
Posted By pamu
awk -F \| 'NR==FNR{A[$0]++;next}{if(A[$1]){print...
awk -F \| 'NR==FNR{A[$0]++;next}{if(A[$1]){print $0","FILENAME}}' 2.txt 1.txt
9,525
Posted By pamu
Please use code tags for code and data sample. ...
Please use code tags for code and data sample.

awk 'FNR == NR { h[$1,$2] = 1; next } h[$1,$2]' file1 file2 > output
4,252
Posted By pamu
Small correction.. awk...
Small correction..

awk '{$0=substr($0,1,7)""substr($0,9,1)}1' file
1,256
Posted By pamu
Hi, I have the files in the following files in...
Hi,
I have the files in the following files in a folder
19996587342
19487656550
19534838736
And i need to get the first 6 characters from the abvoe files
so i used the following script
...
Showing results 1 to 25 of 465

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