Search Results

Search: Posts Made By: mrpugster
2,811
Posted By vgersh99
$ echo 'abcp 10p 0.52p' | sed...
$ echo 'abcp 10p 0.52p' | sed 's/\([0-9.][0-9.]*\)p/\1/g'
abcp 10 0.52
4,434
Posted By ctsgnb
#!/usr/bin/ksh # INFILE should exists ...
#!/usr/bin/ksh
# INFILE should exists
INFILE=tst

# WORKFILE contains the same entries than INFILE
# but reordered so that brand having the most entries appear first in the file
WORKFILE=tst.w...
4,434
Posted By ctsgnb
You should consider adding a non ambiguous...
You should consider adding a non ambiguous separator between the Brand and the product (for example like colon ":" to follow POSIX standard)
Indeed, that would gather the advantages of

1)...
4,434
Posted By michaelrozar17
Could you change as below and try.. awk...
Could you change as below and try..
awk '/Filippo Berio/{print $0 FS $2;next}1' inputfile > outfile
1,345
Posted By yinyuemi
sed -r -e 's/(^[0-9])Kg/\1.0Kg/' -e...
sed -r -e 's/(^[0-9])Kg/\1.0Kg/' -e 's/(^[0-9]{1})g$/0.00\1Kg/' -e 's/(^[0-9]{2})g$/0.0\1Kg/' -e 's/(^[0-9]{3})g$/0.\1Kg/'
1,345
Posted By rdcwayx
awk '/Kg/ {printf "%.1fKg\n", $1;next} {printf...
awk '/Kg/ {printf "%.1fKg\n", $1;next} {printf "%.3fKg\n", $1/1000}' infile

0.250Kg
0.500Kg
0.750Kg
1.0Kg
1.2Kg
0.030Kg
0.375Kg
0.500Kg
0.030Kg
9,472
Posted By rdcwayx
$ cat infile 24x18g 12x18g 300g 24x18Kg ...
$ cat infile
24x18g
12x18g
300g
24x18Kg
12x18Kg
300Kg

$ awk -Fx '{t=$0;gsub(/[0-9x]/,"",t);$0=($1*($2?int($2):1)) t}1' infile

432g
216g
300g
432Kg
216Kg
300Kg
766
Posted By yinyuemi
sed 's/.*pack - //' or awk: awk '{print $NF}'
sed 's/.*pack - //'
or awk:
awk '{print $NF}'
9,472
Posted By alister
Given the lines in your original post, the...
Given the lines in your original post, the following should work:
sed 'y/x/*/; s/g$//' file | bc | sed 's/$/g/'

Regards,
Alister
9,472
Posted By yinyuemi
AWK: echo "24x18g 12x18g 300g" |awk -F"x"...
AWK:
echo "24x18g
12x18g
300g" |awk -F"x" '{print NF==1?$0:$1*gensub("g","",1,$2)"g"}'
432g
216g
300g
9,472
Posted By danmero
echo "24x18g 12x18g 300g" | awk -Fx...
echo "24x18g
12x18g
300g" | awk -Fx '{$0=($1*($2?int($2):1))"g"}1'
432g
216g
300g
Showing results 1 to 11 of 11

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