Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: rdcwayx
2,247
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,857
Posted By rdcwayx
ls ba[aeiou]*
ls ba[aeiou]*
1,984
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,000
Posted By rdcwayx
awk 'NR>2{$0="NEW" RS $0}1' saved_doc
awk 'NR>2{$0="NEW" RS $0}1' saved_doc
1,762
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
1,856
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,409
Posted By rdcwayx
awk '{printf (/^\|/)?$0:RS $0}' infile
awk '{printf (/^\|/)?$0:RS $0}' infile
1,331
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,242
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"
...
878
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,247
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,049
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,851
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,739
Posted By rdcwayx
see the explanation: ...
see the explanation:
https://www.unix.com/302678079-post2.html
2,426
Posted By rdcwayx
But what's the reason to put file1 first?
But what's the reason to put file1 first?
2,426
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,426
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,437
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,082
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,465
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,609
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
1,794
Posted By rdcwayx
ssh hostname "path ksh...
ssh hostname "path ksh HC_Report.ksh>out.html"
2,276
Posted By rdcwayx
go through the ABS (advanced bash scripting...
go through the ABS (advanced bash scripting guide), you should get all the answers.
...
826
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,623
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

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