From: Ron Schwingel (rschwing@ndsltd.com)
Date: Wed Aug 28 2002 - 16:47:29 EDT
Good. Getting closer. I will not always know how many words in a line. I
just used word1 word2 word3 word4 as an example. What can I use if
I don't know how many white spaces are in a line? Something that
acts as a wildcard for everything before and after the string I am
looking for on the line.
Something to replace this I would think.
\([^ ]* [^ ]* [^ ]* [^ ]*\)
Ron Schwingel
Technical Support
NDS Solutions
303.755.4411(phone)
303.755.4545(fax)
rschwing@ndsltd.com
-----Original Message-----
From: Fabrice Guerini [mailto:fabrice@BLUEMARTINI.COM]
Sent: Wednesday, August 28, 2002 2:13 PM
To: aix-l@Princeton.EDU
Subject: Re: Modifying strings in a file.
On 12:56 PM 8/28/2002, Ron Schwingel uttered:
>The below won't work because I will not always know what word2 word3 word4
>is.
>
>sed -e 's/^#Word1 Word2 Word3 Word4/Word1 Word2 Word3 Word4/' file >
>/tmp/file
Ah, why didn't you say so earlier!...
sed -e 's/^#\([^ ]* [^ ]* [^ ]* [^ ]*\)/\1/'
+===========================================================+
| Fabrice "Script It!" Guerini Blue Martini Software, Inc. |
| Senior Operations Engineer 2600 Campus Drive |
| Tel: (650) 356-7576 San Mateo, CA 94403-2522 |
| Fax: (650) 356-4001 www.bluemartini.com |
+===========================================================+
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:10 EDT