- Original Message -
| I am trying to use sed to change a value in a pipe.
|
| --- This is the two line script
| CHANGE=1234
|
| cat my_file.txt | sed 's/CANCELID/$CHANGE/' cancel.txt
| ---
|
| and the my_file.txt has:
|
On 08/25/2015 10:50 AM, Jerry Geis wrote:
cat my_file.txt | sed 's/CANCELID/$CHANGE/' cancel.txt
sed doesn't perform environment variable expansion. That is to say that
when you instruct sed to substitute $CHANGE for CANCELID, $CHANGE
is a literal string that will be substituted.
bash,
On 8/25/2015 10:50 AM, Jerry Geis wrote:
--- This is the two line script
CHANGE=1234
cat my_file.txt | sed 's/CANCELID/$CHANGE/' cancel.txt
---
and the my_file.txt has:
v1:notificationIdCANCELID/v1:notificationId
it gets changed to $CHANGE instead of
On Tue, Aug 25, 2015 at 1:50 PM, Jerry Geis ge...@pagestation.com wrote:
I am trying to use sed to change a value in a pipe.
--- This is the two line script
CHANGE=1234
cat my_file.txt | sed 's/CANCELID/$CHANGE/' cancel.txt
---
and the my_file.txt has:
On 08/25/2015 11:21 AM, Alice Wonder wrote:
cat file.txt |\
sed -e s?foo?bar?g |\
sed -e s?dirty?clean? |\
file2.txt
I don't understand why you'd quote that way. Though unlikely, you could
potentially match a filename in the working directory, and hose the sed
command. For
On 08/25/2015 11:02 AM, Gordon Messmer wrote:
Additionally, you can avoid using cat to make the script more
efficient. You'll start fewer processes, and complete more quickly. cat
is almost never needed unless you actually need to concatenate
multiple files.
I sometimes like to use cat
thank you, and sorry, if i had formulated wrong, but the SOMETEXT#X
is a random STRING, like:
$ cat testfile.txt
alsjflsajfkljasdf
brfont size=3asfklasjlkyxcvo/fontbr
brfont size=3kldfjlkasjdfasdf/fontbr
kasfjxcvklajdflas
yxcvkjasafjads
brfont size=3asdfjkldjlasj/fontbr
/font/div/body/html
Hahahaha,
I see that you posted this in quite a few places. Let me repeat it here
then. BTW, do a bit of homework if you do need fine tuning before
posting back on this list.
awk 'BEGIN {sawpattern=0} ^[[:alpha:]], ^[[:alpha:]] {if (($0
~/brfont size=3[[:alpha:]]/ ) (sawpattern == 0))
% cat foo
Hello line 1
Hello line 2
Hello line 3
# To change just line 2
% sed '2s/Hello/There/'
Hello line 1
There line 2
Hello line 3
# To change line 2 and onwards
% sed '2,$s/Hello/There/'
Hello line 1
There line 2
There line 3
It's that simple :-)
yes indeed - simples
I thought i could use sed to change a particular line number but i dont see
that in the man page, i am trying to change a value from line number 6
% cat foo
Hello line 1
Hello line 2
Hello line 3
# To change just line 2
% sed '2s/Hello/There/'
Hello line 1
There line 2
Hello line 3
# To
-Original Message-
From: centos-boun...@centos.org [mailto:centos-boun...@centos.org] On
Behalf Of Paul Heinlein
Sent: Tuesday, March 09, 2010 11:08 AM
To: CentOS mailing list
Subject: Re: [CentOS] sed help
On Tue, 9 Mar 2010, chloe K wrote:
Hi
Can I know how to use sed
On Mon, Sep 21, 2009 at 3:06 PM, Alan McKay alan.mc...@gmail.com wrote:
avahi-0.6.16-1.el5
avahi-glib-0.6.16-1.el5
produce this :
avahi
avahi-glib
r...@knodd:~# rpm -qa --queryformat %{name}\n avahi\*
avahi
avahi-compat-libdns_sd
avahi-glib
r...@knodd:~#
Ralph
Am Montag, den 21.09.2009, 15:06 +0200 schrieb Alan McKay:
Hey folks,
Once upon a time I saw some sed magic to take the output of rpm -qa
and strip away all the version info to give just the RPM base names.
And of course I forgot to note it :-/ And have not been able to
replicate it
Hi,
On Wed, Aug 19, 2009 at 13:24, Joseph L.
Casalejcas...@activenetwerx.com wrote:
Hey guys,
I am trying to make sed append every line containing a string with another
line.
problem is the appended line needs to start with a tab:
# sed -i '/string/a \tstuff\t\t\tmorestuff' file
Obviously
The a command expects to be followed by a \, so it's eating the
one in your first \t. If you add another \ it seems to work as you
want it to:
$ echo string | sed '/string/a \\tstuff\t\t\tmorestuff'
string
stuff morestuff
$
Ah ffs, lol...
It would also help if I emailed
Hi,
On Wed, Aug 19, 2009 at 16:20, Joseph L.
Casalejcas...@activenetwerx.com wrote:
'/string/a \\tstuff\t\t\tmorestuff' != /string/a \\tstuff\t\t\tmorestuff
Yes, indeed... The rules of quoting and backslashes in the shell are
not very uniform and can get quite tricky... Also, the \t is
On Fri, May 23, 2008 at 11:41 AM, Scott McClanahan
[EMAIL PROTECTED] wrote:
Not specific to CentOS but I know you guys would be really helpful anyhow.
Basically, I have a file which has been editted in the past very similarly
to the hosts file only now I want to use it as a hosts file and need
On Fri, May 23, 2008 at 08:41:19AM -0700, Scott McClanahan wrote:
Not specific to CentOS but I know you guys would be really helpful anyhow.
Basically, I have a file which has been editted in the past very similarly to
the hosts file only now I want to use it as a hosts file and need to run
On Fri, May 23, 2008 at 06:02:29PM +0200, Mihai T. Lazarescu wrote:
On Fri, May 23, 2008 at 08:41:19AM -0700, Scott McClanahan wrote:
1.1.1.1foo
10.10.10.10bar bar2
100.100.100.100foobar foobar2 foobar3
== After ==
1.1.1.1foo.contoso.com
10.10.10.10
Stephen Harris wrote:
On Fri, May 23, 2008 at 06:02:29PM +0200, Mihai T. Lazarescu wrote:
On Fri, May 23, 2008 at 08:41:19AM -0700, Scott McClanahan wrote:
1.1.1.1foo
10.10.10.10bar bar2
100.100.100.100foobar foobar2 foobar3
== After ==
1.1.1.1
On Fri, May 23, 2008 at 06:59:24PM +0200, Thomas Johansson wrote:
Stephen Harris wrote:
sed 's/^\([^]*[ ]*[^]*\)\([ ]*.*\)$/\1.contoso.com\2/'
(where there's a space *and* a TAB inside each of the [ ] )
The above version easier to read and copy paste. Space is space
On Fri, May 23, 2008 at 8:50 AM, Matt Shields [EMAIL PROTECTED] wrote:
I'd use awk. Put the lines in a file, then do this
cat test.txt | awk '{ print $1 \t $2 .centos.com\t $3 \t $4 }'
Or just awk '{ print $1 \t $2 .centos.com\t $3 \t $4 }' test.txt
newhostsfile
(The cat just complicates
Stephen Harris wrote:
On Fri, May 23, 2008 at 06:59:24PM +0200, Thomas Johansson wrote:
Stephen Harris wrote:
sed 's/^\([^]*[ ]*[^]*\)\([ ]*.*\)$/\1.contoso.com\2/'
(where there's a space *and* a TAB inside each of the [ ] )
The above version easier to read and copy
23 matches
Mail list logo