![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| remove spaces btw | tjmannonline | UNIX for Dummies Questions & Answers | 7 | 05-25-2008 11:35 PM |
| Remove spaces from columns | jacks | Shell Programming and Scripting | 2 | 01-18-2008 07:08 AM |
| How to remove trailing spaces | mahek_bedi | UNIX for Dummies Questions & Answers | 2 | 08-10-2007 04:21 AM |
| Removing empty spaces and adding commas | jazz | High Level Programming | 4 | 11-13-2006 06:54 AM |
| how to remove spaces in a string using sed. | radhika | Shell Programming and Scripting | 4 | 06-02-2005 12:00 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hey guys,
I am very much new to shell scripts. So you ppl may feel that i am asking stupid question here. 1. I am using command line argument as an input variable. The user gets this value in his mail from client which has commas n spaces (Eg. 12,34,56,789) and the scripts input should not contain any commas, spaces dashes etc... So to Normalise it i hv used following thing sh 123.sh 12,34,56,789 #12,34,56,789 is jst an example of input i.e. command line argument. echo "$1" | perl -pi -e "s/,//g;" Now the problem is I want to take its output (i.e output of echo "$1" | perl -pi -e "s/,//g;" ) as input for next line of script. For this I tried following thing echo "$1" | perl -pi -e "s/,//g;" | $i But its not working... what do i do? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
echo $1 | sed 's/,//g' And you can assign that like this Code:
S=`echo $1 | sed 's/,//g'` //Jadu |
|
#3
|
|||
|
|||
|
Hey Thanx for the quick reply
The line written by me in script (i.e echo "$1" | perl -pi -e "s/,//g;") even that is working... but what i want to do is, i want to take the output of this line in a variable... So that i can use it further.. Do u kno how do i do it? |
|
#4
|
|||
|
|||
|
This has been already answered by jaduks.. Check the S variable value, in jadu's post.
|
|
#5
|
|||
|
|||
|
var1=`echo $1 | tr "," " "`
If $1 = 1,2,3 Then var1 will contain 1 2 3. Thanks & Regards, Siba Quote:
|
|
#6
|
|||
|
|||
|
Hey thanx a ton Jaduks, nua7 & Siba... finally it worked :-) I m very happy...
|
|||
| Google The UNIX and Linux Forums |