Re: SED Replace Programming Software Development by chris.kelley.5015 sed uses the 's///' command to replace one string with another. … with the folowing: `echo "A...ABCD.DEFG.HIJK" | sed -e 's/\([A-Z]\)\./\1\.int1\./' -e 's/\.\./\.int2/'` The… the sections of the replacement command for sed: `echo "A...ABCD.DEFG.HIJK" | sed -e 's_\([A-Z]\)\._\1… SED Replace Programming Software Development by axn sed - need to replace only the chars or symbol after 1st … result should look like - A.**int1**.**int2**.any.string.here sed -e 's/*/int1/' -e 's/*/int2/' -e 's/ABCD/int1… sed Programming Software Development by Kruptein What am I doing wrong? [code=bash]for filename in /home/darragh/public_html/test/* do sed -i 's/..\/config/.\/config/g' done;[/code] It just gives me: sed: No input files Re: sed Programming Software Development by sknake Forgetting to give the filename to sed: [code] for filename in /home/darragh/public_html/test/* do sed -i 's/..\/config/.\/config/g' ${filename} done; [/code] Re: sed Programming Software Development by sknake Run the script as root or modify your script. 'for' is just a bash command for looping what you need elevated privelages for is possibly the 'ls' and the sed: [code] for filename in `sudo /home/darragh/public_html/test/*` do sudo sed -i 's/..\/config/.\/config/g' ${filename} done; [/code] Sed help Programming Software Development by bufospro … format the comments of file like that : /** Comment */ with a sed script The comments in my file is /* comment 1 */ /* comment… 3 */ I know to format file with diferrent commands like sed -e 's/\/\*\+/\/\*\*\n/g' filename ... but there are empty lines… Re: Sed help Programming Software Development by thekashyap [quote]is it possible to become with only one regular expression ?[/quote] Yes. :) Did you check the "n" command in sed? It basically loads the next line into buffer. Would be useful here. Google for "sed one liners" you should find some examples you can use. sed help Programming Software Development by naveensurisetty Hi can anybody help me in understanding this sed -e "1,/^%!ab-cdef$$/d;s/\.#@%&\*)/\)/g" > file.txt Naveen Re: sed Problem on MAC Hardware and Software Linux and Unix by JasonHippy … think this might be to do with the version of sed that you are using. I think the default version of… from source, or install via homebrew/port). GNU sed is the version of sed you're already using under Cygwin on Windows…, would be to read the documentation for the version of sed which is installed on your mac, learn what regex syntax… Re: sed leaves file empty Programming Software Development by indie … the following lines: cat $F1 | sed -e '/CALIBRATE/s/^#//' > $F1 cat $F2 | sed -e '/CALIBRATE/s/^#//' > …$F2 cat $F3 | sed -e '/CALIBRATE/s/^#//' > $F3…11}'`" fullpath=`ls -l "$fullpath" |sed -e 's/.* -> //' |sed -e 's/\*//'` fi dirname $fullpath } # Set … Re: sed leaves file empty Programming Software Development by Infarction … append the data which you also don't want).* Second, sed takes a file as a final parameter, so you dont… need cat <file> | sed ... * sed also has an in-place option, allowing you to use… will copy the original file to fileSUFFIX, e.g. [inlinecode]sed -i.bkup s/a/b/ somefile[/inlinecode] will create a… Re: sed -f clears the file Programming Software Development by JeoSaurus That's really odd... It works OK on my system: [icode] $ sed -f DBACheck.sql.sed DBACheck.sql select granted_role from sys.dba_role_privs where grantee='SYSTEM'; [/icode] What version of sed are you using? ([icode]sed --version[/icode]) -G Re: Sed or Perl Help Programming Software Development by rch1231 …original file name. You would need something like this: [CODE] sed s/\/opt\/dragon\/bin\/runit/cd\ \/opt\/dragon\/bin\ \;\ …g[/CODE] But this would do the same thing: [CODE] sed s/\/opt\/dragon\/bin\/runit/cd\ \/opt\/dragon\/bin\ \;\ …g[/CODE] You have to use the backslash to tell sed to ignore the normal operation of the slash, space,… sed leaves file empty Programming Software Development by dude67 … line with the following lines: cat $F1 | sed -e '/CALIBRATE/s/^#//' > $F1 cat $F2 | sed -e '/CALIBRATE/s/^#//' > $F2 cat… $F3 | sed -e '/CALIBRATE/s/^#//' > $F3 Another part… sed command not running Programming Software Development by moazzam …. The following command executes successfully echo c:/test.txt | sed -e 's/\//\\\//g' But when i executes the following …command x=`echo c:/test.txt | sed -e 's/\//\\\//g'` I get the following error [B…]sed: command garbled: s/\//\\//g[/B] Is there any way… sed -f clears the file Programming Software Development by shyamalaa … /opt/DBACheck.sql.sed /opt/DBACheck.sql > /opt/DBACheck.sql.tmp mv -f $….sql.tmp $DBACheck.sql where the contents of DBACheck.sql.sed is { s%${DBMS_USER}%SYSTEM%g } DBACheck.sql is a one… Sed wraps some lines, not all Programming Software Development by kristo5747 Greetings. I am using SED to cleanup files that are laid out like so: [icode] …) first, I added a newline to mark each record [icode]sed -i 's/h/h\n/g' infile[/icode], 2) then…, I added the the tab delimiter [icode] sed -i '/.$/N; s/.\n/\t/' infile[/icode] It works but… Sed or Perl Help Programming Software Development by dozierc … I'm stuck. I have been trying to write a sed or perl script to change the below. But each time… I run the sed script or perl it completely zeros out the file. I…/bash for fl in *.php; do mv $fl $fl.old sed 's/old/new/g' $fl.old > $fl rm -f… sed Problem on MAC Hardware and Software Linux and Unix by boshu …. WIN RESULT (works): $ cat lastVersion.txt 4.2.1.98/ $ sed -re 's/[0-9]+\.[0-9]+\.[0-9]+\.([0-9…]+).*/\1/' lastVersion.txt 98 MAC RESULT (does not work): ++ sed -e 's/[0-9]+\.[0-9]+\.[0-9]+\.([0-9…]+).*/\1/' lastVersion.txt 15:46:25 sed: 1: "s/[0-9]+\.[0-9]+\.[0-9] ..."… Re: sed leaves file empty Programming Software Development by Infarction … '{print $11}'`" fullpath=`ls -l "$fullpath" |sed -e 's/.* -> //' |sed -e 's/\*//'` fi dirname $fullpath } # Set the home… Re: sed leaves file empty Programming Software Development by pheeror man sed especially look at -i option sed -i'' b -e 's/a/b/' Re: sed command not running Programming Software Development by eggi Hey There, Just change this [CODE]x=`echo c:/test.txt | sed -e 's/\//\\\//g'`[/CODE] to this [CODE]x=`echo "c:/test.txt" | sed -e 's/\//\\\\\//g'`[/CODE] assuming you want $x to equal: c:\/test.txt Hope that helps :) , Mike Re: sed substitution with variables Programming Software Development by kranny Its due to the behaviour of " [COLOR="Red"]&& [/COLOR]" try this:: line=`sed -n 's/&/x/gp' inputfile` sed -n 's/\\/'"$line"'/p' inputfile|sed 's/x/\&/g' sed problem Programming Software Development by JyotiC hi, Is it possible to restrict the substituion in sed. I mean, that sed runs till it finds the end of file, and… SED: Conditionally removing \n Programming Software Development by tomok … interweb, hopefully someone here can offer me some help with sed! I have a csv file that contains records. Each field… it occurs between comma's. I am quite new to sed, so any help would be much appreciated! Re: SED: Conditionally removing \n Programming Software Development by tomok … the right track! Mike, you are correct about masijade's sed statement, it breaks when there is more than 2 \n… in a line. However, running your sed statement produces no results for some reason. Looking at it… Re: SED: Conditionally removing \n Programming Software Development by masijade … you don't realise it) [code] sed 's/^.*,\n$//' [/code] doesn't work because sed is a line editor. It works one… sed problem Programming Software Development by baku using sed print the lines that have more than 10 characters, of … a=`wc -c andrei.txt` if [ $a -gt $zece ] then sed -f exe.txt andrei.txt fi a=0 done fi… sed substitution with variables Programming Software Development by kneiel … objective: to replace '\' with line 2 newLine=`sed -n "2 p" inputFile` sed -n 's/\\/'"$newLine"'/p' inputFile… sed with arithmetic calculation Programming Software Development by SakuraPink …, I am trying to change hundreds of data files using sed command. Text file1 have 10 lines which look like the… for (( i = 0 ; i <= 9; i++ )) do j=1 sed -e 's/'3428$i'/`'3428$i'+10*j`/g' file1…