substitute the starting dollar sign in command with blank


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting substitute the starting dollar sign in command with blank
# 1  
Old 03-22-2011
substitute the starting dollar sign in command with blank

Hi,,

Let example cmd: $$config/all
Here I want to replace or subsitute blank space and also with any other character in place of "$" sign...and also want to replace backslash (/) with forward (\)......in expect script

please could any one help on this.....thank you
# 2  
Old 03-22-2011
Hi swethakast,
Try with:

Code:
cat inputfile
cmd: $$config/all

sed 's/ \$//;s/\//\\/' inputfile
cmd:$config\all

Regards
# 3  
Old 03-22-2011
Thanks for replaying....

but here i want in expect script..where "sed" cannot accepted by expect
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Linux expand dollar sign in single quotes

I am trying to get a dollar sign variable to be expanded in single quotes. Not sure what I am doing wrong. I have tried every way I can think of. for i in `cat file1` do for j in `cat file2` do ssh $i 'systemctl is-enabled "${j}" '; done done... (4 Replies)
Discussion started by: cokedude
4 Replies

2. Shell Programming and Scripting

Substitute grep command at run time

HI I am trying to use the following code in the shell script (using grep) usage() { echo "Usage: ./$0 <file name> <interval> <pattern>" } METRICS_FILE=$1 INTERVAL=$2 PATTERN="$3" .. if then PATTERN="grep Gx" fi COUNT=`cat ${METRICS_FILE} | "${PATTERN}" |egrep... (8 Replies)
Discussion started by: asifansari
8 Replies

3. UNIX for Advanced & Expert Users

Linux dollar sign in front of directory

I'm looking at a config file with dollar signs. What do the dollar signs mean in front of a directory? dir = ./demoCA # Where everything is kept certs = $dir/certs # Where the issued certs are kept crl_dir = $dir/crl # Where the issued crl are kept new_certs_dir = $dir/newcerts # default... (1 Reply)
Discussion started by: cokedude
1 Replies

4. Shell Programming and Scripting

Grep and dollar command

Hello there, first of all, don't hesitate to notify me if I misbehave. I'm a newbe in the use of this site, and in unix too (in english as well :-) Well, if someone hat a little time to waste, could he explain to me this strange behavior. I'm using ksh under AIX. cdeset=$(su - db2inst1 -c... (8 Replies)
Discussion started by: skitoc
8 Replies

5. Shell Programming and Scripting

sed substitute command -- need help

I am trying to do what I thought should be a simple substitution, but I can't get it to work. File: Desire output: I thought I'd start with a sed command to remove the part of the header line preceding the string "comp", then go on to remove the suffix of the target string (e.g. ":3-509(-)"),... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

6. Shell Programming and Scripting

[Solved] cp command with dollar variable in ksh

hi, I have been trying to acheive the following task for a while now, but failed.. Need help, experts please help! This is what I am trying to do: - I am writing to a flat file the name of the source to be copied and the destination path as to where it is to be copied to. Sample flat file:... (7 Replies)
Discussion started by: abdulhusein
7 Replies

7. Shell Programming and Scripting

String starting with blank space

Dear Masters, Need your help for this small query. I am trying to get all the strings that starts with a blank space as output. Limitation is , it should be done only through AWK. Input will be: aa _1bbb c-ccc ddd eeeee ff Output should be: _1bbb c-ccc eeee ff (5 Replies)
Discussion started by: patric2326
5 Replies

8. Shell Programming and Scripting

howto substitute word in vi command mode

Hi I'm trying to substitute word "January" with word "March" in my script but in certain lines only. I have couple words containing pattern that I want to substitute e.g. - log.January.1.array - log_January_1_array_1 - log.January.1.array - log_January_1_array_11 Trying to do cmd below... (9 Replies)
Discussion started by: presul
9 Replies

9. Shell Programming and Scripting

Sign on/Sign off logging script

I'd like to make a script that I can execute every time I sign on to my linux box that keeps track of the time and allows to me to add a remark to a file. So basically once I log in, I run the script, and it outputs the date and time to a text file (log.txt). But that isn't my problem. I need... (1 Reply)
Discussion started by: Glider
1 Replies

10. UNIX for Dummies Questions & Answers

Substitute Command in vi

How do I substitute a word throughout a file? For example change all instances of the word John to Mark. This would be in vi for korn shell. (10 Replies)
Discussion started by: lesstjm
10 Replies
Login or Register to Ask a Question