Hi guys!
Im a newbie to using sed and would love your help.
What Im trying to do is the following...........
I have a folder that contain multiple filenames that have the following naming convention..
*menu4_it_sware_videogalle
ries_*.php
In these files above, there are multiple instances of teh following string..
../../
The above I wish to change all instances of '../../' to nothing.
The problem Im having is that when Im using the following bash script to do this, the resultant file is totally BLANK, replacing everything with nothing.
Because I wish to replace the backslashes, I thought I had to use an '@' symbol as the delimiter, and not the standard backslash, but this doesnt seem to work.
If i use the below script and test just replacing text other than the backslash character, and change the deliimiters from @ to a '/', the script works.
Any help greatly appreciated.
Here is the script.......
==========================
==========
====== sed_replace.sh:
1 #! /bin/bash
2 for text in *menu4_it_sware_videogalle
ries_*.php
; do
3 mv $text $text.old
4 sed 's@../../@@g' $text.old > $text
5 rm -f $text.old
6 done
==========================
==========
=========
Start Free Trial