sed file problems

when i am running a sed command i want to get rid of all of the backslashes in the lin but it is taking this as being a command how do i delete backslashes?????

sed -e "s/\/g"

Anyn ideas?????????

try this
sed 's/\\//g' file1.out > file2.out

i tried that already but it did not work :frowning: - ended up doing it in a text file which worked but would really like to know how to do it using sed..................

you do not need to user a / as the delimiter for your sed statement, try using the = so your sed command looks like this

sed -e "s=\==g" file1 > file2

Here is a good solution.

cat filename.in |sed 's/\\//g' > newfilename.out

I know this is similar to one post already but I just tested it and it worked for me in ksh on HPUX box.

root> cat file
\todd \qasd \adrladf

root> cat file |sed 's/\\//g' > (your output file here)
todd qasd adrladf

It removes the backslashes. It even works when I concat all of the "words" together or even with multiple consecutive \\ in a file.

:cool:

Useless Use of Cat. Simplify to:

sed 's/\\//g' filename.in > filename.out

Yes, I realized that it was.

However, he said that he already tried it that way. I was just trying to offer an alternative. Possibly there is a problem on his box.

Now that I look at it, he may have been using double quotes which may have made sed take it as a literal.

Try to limit extra commands, but I like to eliminate any variation as a bug.

Hi!

I've the following script code with an input parameter:

sed 's/oldstring/$1/g' myfile > newfile

(I launch it with comman line: $ MyShell newstring)

Problem: the substituion doesn't work (oldstring becomes $1, instead of newstring). How could I solve this situation?

          Thanks,
                       Paride