09-15-2009
sed: command garbled
Hi,
I have a file1 as :
A=/home/user
B=/home/user1
C=/home/user2
D=/home/aacsms
E=/home/user1/temp
F=/home/user1/area1
and my script as:
a=`cat /home/aacsms7/file1 | grep -i e`
b=`user2`
sed 's/'$a'/"E=/home/'$b'/temp"/g' < file1 > file2
sed: command garbled: s/A=/home/user
I am trying to replace value of "E" in file1 as "E=/home/user2/temp" and write it in file2.
Please suggest wher am i wrong or will sed able to handle "/" in the pattern...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Im getting this error message when trying to substitute filepaths in a sed search and replace string
#!/usr/bin/ksh
ORACLE_SID=PH3
ORACLE_ADMIN=/data01/app/oracle/admin/$ORACLE_SID
DATAFILE_DIR=/asterisk/oradata/$ORACLE_SID
sed -e s/DBNAME/$ORACLE_SID/g < initPH2.ora | sed -e... (1 Reply)
Discussion started by: blakmk
1 Replies
2. Shell Programming and Scripting
Dear friends,
please give me the solution to the following query.
If a file contains multiple tags of same name, then how to get the required string between the tags, in which the string begins with "W/X"
i.e., file1.txt contains following text(please note that all the following tags are in... (1 Reply)
Discussion started by: swamymns
1 Replies
3. Shell Programming and Scripting
I fairly new to SED. I have tried many different variations of this line of code and even breaking it down into its components and running them separately.
They work individually without variables but when I place the $todbname variable it will either inserts the text "connect to $todbname"... (3 Replies)
Discussion started by: edewerth
3 Replies
4. Shell Programming and Scripting
Hi,
I really need some help, I am using a very basic script to proess a text file. This script has been used many times but all of a sudden all on it's own it's stopped working.
The line in the script is:
sed 's/
//g' $ORGFILE > $NEWFILE
and the error is Sed: command garbled :s/
All... (3 Replies)
Discussion started by: heidi.lightfoot
3 Replies
5. Shell Programming and Scripting
sed: command garbled: s/ri="*"/ri="
what i did is you can see below
sed "s/ri=\"*\"/ri=\"$newri\"/" $2 > output
how to solve this (2 Replies)
Discussion started by: pasricha.kunal
2 Replies
6. Shell Programming and Scripting
for j in $(cat ${list_B})
do
to_replace_2=$(grep $j ${useralias}_2)
sed "s/^${j}/${to_replace_2}/p" ${entries} > ${entries}_2
mv ${entries}_2 ${entries}
done
Hi,
I've the above sed command running in a script. Its basically looping through a file and replacing its beginning of line... (8 Replies)
Discussion started by: Jazmania
8 Replies
7. Shell Programming and Scripting
Hi all,
What am I doing wrong here?
$ cat test_sed.ksh
#!/usr/bin/ksh
var="sed -e \'6s/9/6/\' testfile.txt > testfile.txt.2"
$var
$ ./test_sed.ksh
sed: command garbled: \'6s/9/6/\'
Thank you! (4 Replies)
Discussion started by: ejianu
4 Replies
8. Shell Programming and Scripting
Hi all,
Suppose that I want to update the db.password entry in the below properties file,
db.username=admin
db.password=qhKkBno2U5GEq5k/dnmGPA== //I want this line to be replaced by: "db.password=abc/123/"
db.host=server
db.port=22
db.sid=database
However when... (2 Replies)
Discussion started by: isaacniu
2 Replies
9. Shell Programming and Scripting
Hi,
First post for a noob so please go easy with me :)
I have a XML block that is originally like this:
<SETNAME>somecrap/THIS</SETNAME>
and I would like it be replaced with, in the original file:
<SETNAME>THIS</SETNAME>
I tried to use:
sed... (4 Replies)
Discussion started by: zhuanyi
4 Replies
10. Shell Programming and Scripting
Hi everyone,
Can anyone help me in question below?
I want to cron a job to add partition every month but get the error sed: command garbled: s/YYYYMM/ .
> echo $YYYYMON_NEW
201304
> echo $YYYYMON_OLD
201208
> echo $YYYY_MM_NEW
2013-05
This is my base script:
ALTER TABLE STS.ADMIN ADD... (1 Reply)
Discussion started by: fenocean
1 Replies
rcp(1c) rcp(1c)
Name
rcp - remote file copy
Syntax
rcp [ -p ] file1 file2
rcp [-r] [-p] file... directory
Description
The command copies files between machines. Each file or directory argument is either a remote file name of the form rhost:path, or a local
file name. Local file names do not contain colons (:) or backslashes () before colons.
Note that the command refuses to copy a file onto itself.
If path is not a full path name, it is interpreted relative to your login directory on rhost. To ensure that the metacharacters are inter-
preted remotely, a remote host's path can be quoted by either using a backslash () before a single character, or enclosing character
strings in double (") or single (') quotes.
The command does not prompt for passwords; your current local user name must exist on rhost and allow remote command execution via
The command handles third party copies, where neither source nor target files are on the current machine. Hostnames may also take the form
rname@rhost to use rname rather than the current user name on the remote host. The following example shows how to copy the file foo from
user1@mach1 to user2@mach2:
$ rcp user1@mach1:foo user2@mach2:foo
Note that the file .rhosts on mach2 in user2's account must include an entry for mach1 user1. Also note that it may be necessary for the
person implementing the command to be listed in the .rhosts file for mach1 user1.
By default, the mode and owner of file2 are preserved if file2 already exists. Otherwise, the mode of the source file modified by on the
destination host is used.
Options
-p Preserves the modification times and modes of the source files in its copies, ignoring the
-r Copies files in all subdirectories recursively, if the file to be copied is a directory. In this case the destination must be a
directory.
Restrictions
The command is confused by output generated by commands in a .cshrc file on the remote host. In particular, `where are you?' and `stty:
Can't assign requested address' are messages which can result if output is generated by the startup file.
See Also
ftp(1c), rlogin(1c), rsh(1c)
rcp(1c)