Search Results

Search: Posts Made By: malcomex999
6,857
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);
...
2,934
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,934
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
3,686
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,463
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,603
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
3,465
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,940
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,767
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!!!;)
2,199
Posted By malcomex999
a=12345_start b=12345_end awk...
a=12345_start
b=12345_end
awk '/'"$a"'/,/'"$b"'/' in > out
1,407
Posted By malcomex999
a=12345 sed '1,/'"$a"'/d' infile
a=12345
sed '1,/'"$a"'/d' infile
2,985
Posted By malcomex999
awk -F\/ 'NF>2{print $1,$NF}' infile
awk -F\/ 'NF>2{print $1,$NF}' infile
2,507
Posted By malcomex999
Try... awk '$1~/^\/dev\/dsk/{print $1}'
Try...

awk '$1~/^\/dev\/dsk/{print $1}'
13,661
Posted By malcomex999
du /mount | sort -rn
du /mount | sort -rn
1,243
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
11,504
Posted By malcomex999
awk 'FNR==2{print $0 > "new"FILENAME}'...
awk 'FNR==2{print $0 > "new"FILENAME}' file[123].txt
15
AWK
4,300
Posted By malcomex999
How about just... awk '$3==$5{print...
How about just...


awk '$3==$5{print $1,$2}' infile
2,063
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
3,363
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
6,052
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
5,194
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.
4,761
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
6,740
Posted By malcomex999
nawk -F "|" '{gsub("004","IND",$2)}1' OFS="|"...
nawk -F "|" '{gsub("004","IND",$2)}1' OFS="|" filename
2,072
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...
5,191
Posted By malcomex999
Assuming your file having the first two rows as...
Assuming your file having the first two rows as headers ...
Try...
awk 'NR>2{print substr($0,6,20) substr($0,26,10) substr($0,36,20)}' infile
Showing results 1 to 25 of 28

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