![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Simple Question | aforball | UNIX for Dummies Questions & Answers | 3 | 03-04-2008 01:26 PM |
| simple sed question | funksen | Shell Programming and Scripting | 10 | 04-08-2007 02:54 PM |
| Simple C question... Hopefully it's simple | Xeed | High Level Programming | 6 | 12-15-2006 11:29 AM |
| Ok simple question for simple knowledge... | Corrail | UNIX for Dummies Questions & Answers | 1 | 11-28-2005 10:03 AM |
| Simple ksh question | frustrated1 | Shell Programming and Scripting | 1 | 11-05-2003 09:41 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#8
|
|||
|
|||
|
Quote:
Code:
echo "1234.23" | sed 's/\([0-9]*\)\.\([0-9]*\)/\1,\2/' |
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
Quote:
Code:
$ echo dfd.dfd | sed 's/\([0-9]*\)\.\([0-9]*\)/\1,\2/' dfd,dfd |
|
#10
|
|||
|
|||
|
Quote:
sed 's/\([0-9]\)\.\([0-9]\)/\1,\2/g' filename should be fine |
|
#11
|
|||
|
|||
|
Quote:
Code:
perl -e ' while (<>) { chomp; if( $_ =~ /(\d+)\.(\d+)/ ) { s/\./,/g; print "$_\n"; } else { print "$_\n" } }' filename
|
|
#12
|
|||
|
|||
|
Quote:
What is the need to replace number and ' . ' as number and ' , ' or ' . ' and number as ' , ' and number in a combined expression just one of the them would do, Code:
sed "s/\([0-9]\)\./\1,/g" a Code:
sed "s/\.\([0-9]\)/,\1/g" a |
|
#13
|
|||
|
|||
|
Quote:
Code:
$ echo ".34" | sed "s/\([0-9]\)\./\1,/g" .34 $ echo "23." | sed "s/\.\([0-9]\)/,\1/g" 23. |
|
#14
|
|||
|
|||
|
this is cool!
It didnt strike for me about the ".34" and "34." kind of numbers Code:
perl -e ' while (<>) { chomp; if( $_ =~ /(\d+)\.(\d+)/ || $_ =~ /\.(\d+)/ || $_ =~ /(\d+)\./ ) { s/\./,/g; print "$_\n"; } else { print "$_\n" } }' filename
|
|||
| Google The UNIX and Linux Forums |