Login or Register to Ask a Question and Join Our Community

Search Results

Search: Posts Made By: rdcwayx
2,652
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
3,971
Posted By rdcwayx
ls ba[aeiou]*
ls ba[aeiou]*
2,112
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,081
Posted By rdcwayx
awk 'NR>2{$0="NEW" RS $0}1' saved_doc
awk 'NR>2{$0="NEW" RS $0}1' saved_doc
1,875
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,020
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,539
Posted By rdcwayx
awk '{printf (/^\|/)?$0:RS $0}' infile
awk '{printf (/^\|/)?$0:RS $0}' infile
1,458
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,345
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"
...
983
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,350
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,149
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...
1,961
Posted By rdcwayx
could you please show me this command and its...
could you please show me this command and its ouput?

echo $LANG
2,947
Posted By rdcwayx
see the explanation: ...
see the explanation:
https://www.unix.com/302678079-post2.html
2,825
Posted By rdcwayx
But what's the reason to put file1 first?
But what's the reason to put file1 first?
2,825
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...
2,825
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,521
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 *
1,151
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
2,659
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
2,762
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
2,001
Posted By rdcwayx
ssh hostname "path ksh...
ssh hostname "path ksh HC_Report.ksh>out.html"
2,478
Posted By rdcwayx
go through the ABS (advanced bash scripting...
go through the ABS (advanced bash scripting guide), you should get all the answers.
...
878
Posted By rdcwayx
See my reply in your thread: ...
See my reply in your thread:
https://www.unix.com/shell-programming-scripting/209511-shell-script-print-date-no-records.html
1,752
Posted By rdcwayx
I have answered your question in another thread. ...
I have answered your question in another thread.

https://www.unix.com/shell-programming-scripting/209511-shell-script-print-date-no-records.html#post302741713
Showing results 1 to 25 of 405

 

Featured Tech Videos