Search Results

Search: Posts Made By: rdcwayx
89,661
Posted By rdcwayx
set a init file as: (So you can have a long list)...
set a init file as: (So you can have a long list)

$ cat template

JAM BUTTER
BREAD CRACKER
SCOOP FORK
SPREAD SPLAT
......

for file in $(ls *.txt)
do
awk 'NR==FNR {a[$1]=$2;next} {for...
10,335
Posted By rdcwayx
awk -F "" '{for (i=1;i<=NF;i++) if...
awk -F "" '{for (i=1;i<=NF;i++) if (i==106||i==157||i==237) $i="xxx"}1' OFS="" urfile
4,127
Posted By rdcwayx
It is not solved by above code. if you have...
It is not solved by above code. if you have several lines, you calculate wrong.

try this:
grep -o "\." infile|wc -l
awk '{sum+=gsub(/\./,"")}END{print sum}' infile
12,754
Posted By rdcwayx
awk -F , '! a[$1 FS $2] {b[$1]++;a[$1 FS...
awk -F , '! a[$1 FS $2] {b[$1]++;a[$1 FS $2]++}END {for (i in b) print i","b[i]}' infile
4,494
Posted By rdcwayx
ls ba[aeiou]*
ls ba[aeiou]*
2,790
Posted By rdcwayx
how about this, it is not exact for your request,...
how about this, it is not exact for your request, but get mostly.

perl -l40pe 's/^-+/\n/' svn.log|awk -F \| '{$3=""}1'

r7351 user01 2 lines Changed paths: D /trunk/demo/proj1/.project ...
1,469
Posted By rdcwayx
awk 'NR>2{$0="NEW" RS $0}1' saved_doc
awk 'NR>2{$0="NEW" RS $0}1' saved_doc
2,611
Posted By rdcwayx
awk 'NR==FNR{a[$1 FS $2];next} !($1 FS $2 in a)'...
awk 'NR==FNR{a[$1 FS $2];next} !($1 FS $2 in a)' file2 file1

sc2/10 10 . G C 50 F=5;U=4
sc2/24 24 . T G 31 F=5;U=4
sc2/11 30 . A T 60 F=5;U=4
2,937
Posted By rdcwayx
so what's the reason to set another array b? ...
so what's the reason to set another array b?
awk '{a[$0]++} END{for(i in a){if (a[i]==1) {print i}}}' infile
1,717
Posted By rdcwayx
I don't review the logic with better arithmetic,...
I don't review the logic with better arithmetic, I just provide the same function for shorter script as same as in your code

cat test.sh

echo $1|awk '{if ($5=="24") print $1,$2,$3, "0/24"
...
2,366
Posted By rdcwayx
awk '{printf (/^\|/)?$0:RS $0}' infile
awk '{printf (/^\|/)?$0:RS $0}' infile
2,070
Posted By rdcwayx
#!/bin/bash # Put Values in an myarrayname and...
#!/bin/bash
# Put Values in an myarrayname and read them back
file="file.txt" # input filename

while read line ;do
wardevent=${line:3:2} # find the wardells...
1,211
Posted By rdcwayx
awk -F "[=,]" '{delete a printf...
awk -F "[=,]" '{delete a
printf $1 "="
for (i=2;i<=NF;i++) a[$i]
for (i in a) printf i ","
printf RS}' infile |sed 's/,$//'
1,711
Posted By rdcwayx
recommend to move below lines to BEGIN{} part in...
recommend to move below lines to BEGIN{} part in awk, which will avoid to gsub on each line again.

gsub ( "-", X, ST )
gsub ( "-", X, EN )
1,507
Posted By rdcwayx
awk '{print $1*1.2}' datafile.txt
awk '{print $1*1.2}' datafile.txt
1,821
Posted By rdcwayx
this command is so dangerous, if string is not...
this command is so dangerous, if string is not defined correctly (empty), the whole three folders will be deleted directly without any prompt by "rm -rf"

---------- Post updated at 01:51 PM...
2,358
Posted By rdcwayx
could you please show me this command and its...
could you please show me this command and its ouput?

echo $LANG
3,468
Posted By rdcwayx
awk '{a[$NF]=a[$NF] FS $1}END{for (i in a) print...
awk '{a[$NF]=a[$NF] FS $1}END{for (i in a) print "Assigned Values: " ,a[i] |mailx -s "Group info" i}' infile
3,777
Posted By rdcwayx
see the explanation: ...
see the explanation:
https://www.unix.com/302678079-post2.html
1,854
Posted By rdcwayx
I guess you use the du command with -h option....
I guess you use the du command with -h option. Try -k

du -sk *
4,057
Posted By rdcwayx
But what's the reason to put file1 first?
But what's the reason to put file1 first?
4,057
Posted By rdcwayx
awk 'NR==FNR{ if ($2~/\$/) {sub(/\$/,"",$2); if...
awk 'NR==FNR{ if ($2~/\$/) {sub(/\$/,"",$2); if (/paid/) {a[$1]+=$2} ;if (/due/) a[$1]-=$2}}
NR>FNR{printf "%s balance:$%.2f \n",$1,a[$1]+0}' file2 file1

CoCo balance:$-10.65
Hiel...
4,057
Posted By rdcwayx
How about it? awk...
How about it?
awk '{sub(/\$/,"",$2)}/paid/{a[$1]+=$2}/due/{a[$1]-=$2}
END{for (i in a) printf "%s balance:$%.2f \n",i,a[i]}' infile

CoCo balance:$5.40
Euda balance:$45.00
1,375
Posted By rdcwayx
awk '/HANDVEL/{print;next}{for (i=1;i<=NF;i=i+2)...
awk '/HANDVEL/{print;next}{for (i=1;i<=NF;i=i+2) print $i,$(i+1)}' infile
3,033
Posted By rdcwayx
$ awk '{for (i=1;i<=NF;i++) if (i<=NR) printf $i...
$ awk '{for (i=1;i<=NF;i++) if (i<=NR) printf $i FS}' infile
1 0 8 9 2 6 6 8 9 6 7 9 4 9 9 9 0 3 4 7 9

$ awk '{for (i=1;i<=NF;i++) if (i<NR) printf $i FS}' infile
0 9 2 6 8 9 7 9 4 9 9 0 3 4 7
Showing results 1 to 25 of 405

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