Click here to Skip to main content
15,867,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!

I have to replace or erase some strings in a file.

I use following syntax:

sed -i '2d;3d;6d;7d;9d;10d' /opt/atpcu/vfw/bin/vfw.checksum


This command removes some lines within the file which are not needed and works great on the console.

I have also tried this commmand (also works on the console)

C#
sed '2d;3d;6d;7d;9d;10d' /opt/atpcu/vfw/bin/vfw.checksum > /opt/atpcu/vfw/bin/vfw.checksum.bak
mv /opt/atpcu/vfw/bin/vfw.checksum.bak  /opt/atpcu/vfw/bin/vfw.checksum



On the console this commands work perfectly, but when I execute this command within the postinstall script of a debian packet it leaves me the file empty after installation of that debian packet.

Any ideas why?

Oh, I also do some other replacements on other files within the postinstall script like:

sed -i 's|.*/Linux_ppc/TEST|'/optrd/run/TEST'|g' /opt/TEST/etcsc/bin/TEST.check 2> /dev/null


and this command works both on console and within the postinstall script(changed file is not empty!)

regards

Adam
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900