Search Results

Search: Posts Made By: malcomex999
6,501
Posted By malcomex999
Try this if you don't want to reset the index...
Try this if you don't want to reset the index position for each line...

awk '{ for(i=1;i<=NF;i++)
{ if(index($i,"alice")!=0)
printf ("%d ",index($i,"alice") + len);
...
4,477
Posted By malcomex999
#!/bin/ksh fax=$(grep abcd file1.dat | cut...
#!/bin/ksh
fax=$(grep abcd file1.dat | cut -c1-12)

if [ -z ${fax} ]; then
fax_no="000-000-0000"
else
fax_no=$fax
fi
echo $fax_no
3,202
Posted By malcomex999
awk 'NR==FNR{a[$1 FS $3]=$2;b[$1 FS $4]=$2;next} ...
awk 'NR==FNR{a[$1 FS $3]=$2;b[$1 FS $4]=$2;next}
{print (a[$0] || b[$0]?$0 FS a[$0] b[$0]:$0 FS "-")}' file2 file1
2,678
Posted By malcomex999
awk -F\| '{for(i=0;++i<=NF;) if($i ~ /Acct/)...
awk -F\| '{for(i=0;++i<=NF;) if($i ~ /Acct/) print substr($i,6)}' infile--
2,678
Posted By malcomex999
Expecting your file is a plain text so try...
Expecting your file is a plain text so try this...

awk -F\| '{for(i=0;++i<=NF;) if($i ~ /Acct/) print $i}' infile
15,496
Posted By malcomex999
Try... awk -F, '{for(i=0;++i<=length($7);) ...
Try...

awk -F, '{for(i=0;++i<=length($7);)
if($4==substr($7,i,length($4))){print $0"|| Matched";next}
{print $0"|| Not Matched"}
}' infile
1,918
Posted By malcomex999
a) You don't need to declare a variable in awk so...
a) You don't need to declare a variable in awk so x is null.
b) gsub(/\047/,x,$i)
c) $i ~ /[0-9]/ matches any digit found in the element. i.e, it matches 11,a11,11a,1a1,aa1. So, it matches in the...
6,098
Posted By malcomex999
awk -F"[,\|]"...
awk -F"[,\|]" 'NR==FNR{arr[$1]=$2","$3;next}arr[$1]{print $2","arr[$1]}' file1.txt looup.txt
Forum: Solaris 02-01-2011
2,948
Posted By malcomex999
awk -F, -v m=\"...
awk -F, -v m=\" '{c2=split($2,col2,";");c3=split($3,col3,";");c5=split($5,col5,";")
for(i=0;++i<=c2;)
for(j=0;++j<=c3;)
for(k=0;++k<=c5;)
print $1,col2[i] m,col3[j] m,$4,col5[k] m}'...
1,727
Posted By malcomex999
Isn't this what you want... echo $peak...
Isn't this what you want...

echo $peak $days_remaining |awk '{ printf "Per day: %.2f GB\n", (50-($1/1000000000))/$2 }'

Just added /$2 to your code
Forum: AIX 12-09-2010
3,401
Posted By malcomex999
You can give a try to the above Awk script i...
You can give a try to the above Awk script i posted!!!;)
1,272
Posted By malcomex999
a=12345 sed '1,/'"$a"'/d' infile
a=12345
sed '1,/'"$a"'/d' infile
1,803
Posted By malcomex999
a=12345_start b=12345_end awk...
a=12345_start
b=12345_end
awk '/'"$a"'/,/'"$b"'/' in > out
2,566
Posted By malcomex999
awk -F\/ 'NF>2{print $1,$NF}' infile
awk -F\/ 'NF>2{print $1,$NF}' infile
12,406
Posted By malcomex999
du /mount | sort -rn
du /mount | sort -rn
2,345
Posted By malcomex999
Try... awk '$1~/^\/dev\/dsk/{print $1}'
Try...

awk '$1~/^\/dev\/dsk/{print $1}'
1,166
Posted By malcomex999
Try... awk -F"[][]" '{for(i=0;++i<=NF;){ ...
Try...

awk -F"[][]" '{for(i=0;++i<=NF;){
if(i%2==0){
printf "[";print $i >> "words";printf "]"}
else{printf $i}
}{printf "\n"}
}' infile
9,005
Posted By malcomex999
awk 'FNR==2{print $0 > "new"FILENAME}'...
awk 'FNR==2{print $0 > "new"FILENAME}' file[123].txt
15
AWK
3,973
Posted By malcomex999
How about just... awk '$3==$5{print...
How about just...


awk '$3==$5{print $1,$2}' infile
1,772
Posted By malcomex999
This should work as your sample file... awk...
This should work as your sample file...
awk '{printf ($0 ~ /^[A-Za-z]/?RS $0:FS $0)}' infile
2,984
Posted By malcomex999
Try if i understand you correctly... ls -1 |...
Try if i understand you correctly...

ls -1 | awk -F\_ '{print $1,++arr[$1]}'
Forum: AIX 05-31-2010
5,436
Posted By malcomex999
Is that how exactly your file looks like,...
Is that how exactly your file looks like, Otherwise give a good sample file...

# echo 001200AM | sed 's/^00/12/'
121200AM
4,443
Posted By malcomex999
If you don't know the number of columns... awk...
If you don't know the number of columns...
awk 'NR==1{for(i=0;++i<=NF;) printf (i==NF?"Header" i RS:"Header" i FS)}1' infile
4,648
Posted By malcomex999
If you made a little search in the forum, you...
If you made a little search in the forum, you would get the answer...:b:

echo "1
2
3
4
5" | sed '2d'
This deletes line two.
1,690
Posted By malcomex999
Assuming n is a sequence of numbers and just a...
Assuming n is a sequence of numbers and just a single letter C before the n...
awk '{arr[$1]=$2;K=$1}END{
for(i in arr){
gsub(/C/,"",K)
I=i;gsub(/C/,"",i)
if(i<=K) print...
Showing results 1 to 25 of 28

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