Re: Need help with SED
kn srivastava <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <CABOZqg4kz9nNWDuO5PL1LzvEMF2QOW12ARFy0VvT2+jUfzGuiw@mail.gmail.com> |
GNU sed version 4.1.5 Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, to the extent permitted by law. On Sun, Feb 17, 2013 at 8:04 PM, Daniel <[email protected]> wrote: > > > What does sed -v or sed --version say? > Always helpful to know what version. > > What is the error message when you don't > use -i and use "move junk.txt" instead? > > s/1\.0101/1.0400/g is safer (very picky). > > Does it work without the "%%a" syntax? > In other words, try a simple case first, > to narrow down where the problem is. > > Daniel > > --- In [email protected], kn srivastava <k-n-s@...> wrote: >> >> sed: cannot rename ./sedDOSSUX: File exists >> >> I get the above message. >> >> Regards >> Kailash >> >> On Fri, Feb 15, 2013 at 5:24 PM, Amarendra Godbole >> <Amarendra_Godbole@...> wrote: >> > I place editing can be problematic which is why classic sed does not touch the original file. This is a gnu extension (a move to make it more user friendly but broken in my opinion). So you should have gnu sed on windows. Secondly make sure the -i switch is not broken for your version. Thirdly tell us what does it complain and maybe I can help further. >> > >> > -ag >> > >> > -- >> > sent via 100% recycled electrons from my mobile command center. >> > >> > On Feb 15, 2013, at 2:51 AM, "goshainganj" <k-n-s@...> wrote: >> > >> >> @echo off >> >> dir /b /s | find ".pscx" > mydir.txt >> >> pushd . >> >> for /F "delims==" %%a in (mydir.txt) do ( >> >> echo "%%a" >> >> sed -i "s/1.0101/1.0400/g" "%%a" > junk.txt >> >> move junk.txt "%%a" >> >> ) >> >> popd >> >> del mydir.txt >> >> ------------------- >> >> >> >> I wrote the above code to change 1.0101 to 1.0400 in all .pscx files in all directories from where I am executing this batch file. >> >> >> >> I read SED manual and it said -i option would directly change .pscx files but it complained. So I directed the output to junk.txt. I wanted to move junk.txt back to .pscx file. It is this part of the above script that's not working. >> >> >> >> Any suggestions why -i is not working and how I can make the above to work? >> >> >> >> Thanx >> >> Kailash >> >> >> >> >> >> >> >> >> >> ------------------------------------ >> >> >> >> -- >> >> Yahoo! Groups Links >> >> >> >> >> >> >> > > > > > ------------------------------------ > > -- > Yahoo! Groups Links > > >