Need Help using sed command(very urgent)

Hi all,

Actually i want to delete the .ps extension from package1.ps string by using sed.

Can any body tell me that how shell i do it?????????

It is very urgent. Can anybody help me. I am trying to do this in the following way.

ps_file="package1.ps"
echo $ps_file
sed s/.ps//g $ps_file
echo $ps_file

When i am running this one i am getting the following error

package1.ps
Can't open package1.ps
package1.ps

Any specific reason for using sed..?

How about.. " mv package1.ps package1"

Hi The below script would work for you,

ps_file="package1.ps"
echo $ps_file
ps_file1=`echo $ps_file| sed "s/.ps//g"`
echo $ps_file1 ---> This variable hold the file name "package1"

Yes,

Because i have one file test.ls which contains following files.

package1.ps
package2.ps
package3.ps
package4.ps
package5.ps
package6.ps
package7.ps

and i want to remove all the extensions of .ps

Suppose that you keep your *.ps files in psdir directory:

for i in `ls /psdir/*.ps`
do
  j=`echo $i|sed 's/.ps//'`
  mv $i $j
done

---
Franci

sed  's/.ps$//g' test.ls > newfile

Shell i create a new file (newfile as shown below) to store the values of test.ls after deleteing .ps???????????
sed 's/.ps$//g' test.ls > newfile

Now suppose my shell script file name is test.sh and the contents of this test.sh file are

ps_file="package1.ps"
echo $ps_file
ps_file1=`echo $ps_file| sed "s/.ps//g"`
echo $ps_file1
ps2pdf -dSAFER -sPAPERSIZE=a4 /tmp/A380_RFS24/amm_r0_ps/$ps_file1.ps /tmp/A380_RFS24/amm_r0_pdf/$ps_file1.pdf

Now i want to store the output of this test.sh file in test.log file.

For this i have writtent the following command

test.sh > test.log

But i don't want to store the output like the above methods.

Can i do this one like the following ways????
ps_file="package1.ps"
echo $ps_file > test.log
ps_file1=`echo $ps_file| sed "s/.ps//g"`
echo $ps_file1 > test.log
ps2pdf -dSAFER -sPAPERSIZE=a4 /tmp/A380_RFS24/amm_r0_ps/$ps_file1.ps /tmp/A380_RFS24/amm_r0_pdf/$ps_file1.pdf > test.log[/b]

 $ cat temp.txt | perl -pe 's/\.ps//g'
package1
package2
package3
package4
package5
package6
package7

thanks to all of you. Now it is working fine.