Search Results

Search: Posts Made By: danmero
1,576
Posted By danmero
Hi Don Cragun, your solution is simpler and run...
Hi Don Cragun, your solution is simpler and run 30% faster that my. Thanks.
1,394
Posted By danmero
awk '/\"/{for(i=2;i<=NF;i+=2){print $i}}' FS=\" ...
awk '/\"/{for(i=2;i<=NF;i+=2){print $i}}' FS=\" file
2,280
Posted By danmero
Base on your data sample try the following...
Base on your data sample try the following one-liner
awk 'END{for(l=1;l++<NF;)print o[l]}{for(l=I;l++<NF;){o[l]=((o[l])?o[l]FS:S)$l}}' file


Since this is your first post please read and...
1,450
Posted By danmero
awk '/^2011-12-26 14:37/,/^2011-12-26 14:58/' file
awk '/^2011-12-26 14:37/,/^2011-12-26 14:58/' file
1,166
Posted By danmero
awk -F\> '/^#/{_=$NF}{sub(/^seq/,_)}_' file
awk -F\> '/^#/{_=$NF}{sub(/^seq/,_)}_' file
1,631
Posted By danmero
awk...
awk '/^#/{++c}NF{file="file"c".file_prod_reg";print $0 > file}' file
6,547
Posted By danmero
awk 'BEGIN{FS=OFS="|"}{$11="word1";$12="word2"}1'...
awk 'BEGIN{FS=OFS="|"}{$11="word1";$12="word2"}1' file
1,356
Posted By danmero
Using parameter expansion in bash 4.x ...
Using parameter expansion in bash 4.x
today=$(date)
today="${today^^}"
1,836
Posted By danmero
for i in *.syl;do echo $(<$i) ${i%.*};done We...
for i in *.syl;do echo $(<$i) ${i%.*};done
We don't need UUoC
14,423
Posted By danmero
awk 'BEGIN{FS=OFS="|"}{y=$6!=x?0:y;x=$6}$5=++y'...
awk 'BEGIN{FS=OFS="|"}{y=$6!=x?0:y;x=$6}$5=++y' file
14,423
Posted By danmero
awk -F\| '$5=NR' OFS=\| file
awk -F\| '$5=NR' OFS=\| file
1,584
Posted By danmero
awk 'NR==1 || /#END/{f--;next}/#START/{print...
awk 'NR==1 || /#END/{f--;next}/#START/{print x;f++;next}f' file
1,903
Posted By danmero
# awk -F'[ |]' '{for(i=0;++i<=NF;){if($i){printf...
# awk -F'[ |]' '{for(i=0;++i<=NF;){if($i){printf $i ((i==NF)?ORS:($i~"the|ke")?OFS:"|")}}}' file
1|2|3|test|james|ke the one|value
1|2|3|test|the value|comp
1|2|3|test|james|value...
2,812
Posted By danmero
df -k "$fs" | awk 'NR==2 {print int($4) }' ...
df -k "$fs" | awk 'NR==2 {print int($4) }'
should do the job :rolleyes:
2,122
Posted By danmero
awk -F"[./]" '$1=$1' file ;)
awk -F"[./]" '$1=$1' file
;)
1,705
Posted By danmero
awk 'NR==FNR{a[$2]=$0;next}{print...
awk 'NR==FNR{a[$2]=$0;next}{print a[$1]?a[$1]:"ABSENT"}' file1 file2
1 a rew sdf ghd 234 gfd 345
ABSENT
7 c dns esd lkn 765 nkc 093
4 d bhj asd klj 231 kljn 211
ABSENT
3 f hjk kln ghj 879 nkj...
1,173
Posted By danmero
Let's try this one: awk -v x=0 '$1==x{print...
Let's try this one:
awk -v x=0 '$1==x{print NR}' file
27
3,362
Posted By danmero
Ops, first answer was wrong ;) awk...
Ops, first answer was wrong ;)
awk 'BEGIN{FS=OFS=","}{x=split($2,a," ");for(i=0;++i<=x;){$2=a[i];print}}' file
2,364
Posted By danmero
awk ' BEGIN {OFS="\t\t";while(getline <...
awk ' BEGIN {OFS="\t\t";while(getline < "file2"){m[$1]=$2;n[$1]=$3}}{m[$1]+=$2;n[$1]+=$3}{print $1,m[$1],n[$1]}' file1
or using sort at the end
awk 'BEGIN{OFS="\t\t"}END{for(i in a) print...
1,248
Posted By danmero
Sorry, I'm not the one :rolleyes: however you can...
Sorry, I'm not the one :rolleyes: however you can take a look at http://wiki.bash-hackers.org/syntax/pe
1,805
Posted By danmero
awk -vVar="linux from the text"...
awk -vVar="linux from the text" 'tolower($0)~Var{print NR}' file > new.file
2,740
Posted By danmero
awk 'BEGIN{FS=OFS="|"}END{p($0,z)}function...
awk 'BEGIN{FS=OFS="|"}END{p($0,z)}function p(y,z){print y z}{$NF=_;if(NR-1 && P!=$0){p(P,z);z=0};P=$0;z++}' file
199|TST-GURGAON|GURGAON|9
1|TST - MAIN LAB|DELHI|3
333|TST-PREET VIHAR|DELHI|4...
1,257
Posted By danmero
echo entry1 entry2 entry3 entry4 |awk...
echo entry1 entry2 entry3 entry4 |awk '{for(;++i<=NF;)$i=$i FS $i}1'
3,091
Posted By danmero
awk -F'[ =,]'...
awk -F'[ =,]' '/^dn:/{x=$3;y=$0;next}/^mail:/{sub(x,$NF,y);$0=y ORS$0}1' file
2,651
Posted By danmero
For a disordered list i'll opt for: awk -F[.=]...
For a disordered list i'll opt for:
awk -F[.=] '!NF{next}$(NF-1)=="user"{x=$NF;sub($(NF-1)"="$NF,y);a[$0]=x}$(NF-1)=="password"{x=$NF;sub($(NF-1)"="$NF,y);if(a[$0])b[$0]=x}a[$0] && b[$0]{print...
Showing results 1 to 25 of 114

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