This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Edit file


This is rather off topic since it's not a cygwin problem, IMO, but I'll help
you anyway because I'm nice like that :P

What you probably want is:

bash$ cat visualiser/PositionData.java | sed "s!import
visualiser.HostIDVPatcher;!//import visualiser.HostIDVPatcher;!" > out.txt

I've used ! instead of / because it saves you having to escape the // and
sed lets you use almost any delimiter that you want.  I haven't actually
tested this and so I can't vouch 100% that it'll work, however it should.
If you carry on having problems then email me privately and I'll see what I
can do to help you out.

HTH,

Carl

-----Original Message-----
From: Rob [mailto:relaxedrob@optushome.com.au]
Sent: Friday, January 11, 2002 1:48 PM
To: Cygwin
Subject: Edit file


Howdy!

I would like to make a script that can change a line in a file.. commenting
out a line in a java source file to be precise.

I would like to look for this line:
  import visualiser.HostIDVPatcher;
and edit it to this:
  // import visualiser.HostIDVPatcher;

Can I do this?

I tried using sed with this line:

cat visualiser/PositionData.java | s/import
visualiser.HostIDVPatcher;/\/\/import visualiser.HostIDVPatcher;/ | out.txt

and this was what I got:

<r;/\/\/import visualiser.HostIDVPatcher;/ | out.txt
BASH: s/import: No such file or directory
BASH: ///import: No such file or directory
BASH: /: is a directory
BASH: out.txt: command not found

Thanks for any help!

Rob



:-)
;->
:-]


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


=======================================================================
Information in this email and any attachments are confidential, and may
not be copied or used by anyone other than the addressee, nor disclosed
to any third party without our permission.  There is no intention to
create any legally binding contract or other commitment through the use
of this email.

Experian Limited (registration number 653331).  
Registered office: Talbot House, Talbot Street, Nottingham NG1 5HF

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]