Thanks for the feedback guys. In the end I discovered the following REALLY
helpful web page "Sed - An Introduction" at
http://www.grymoire.com/Unix/Sed.html. As it says in th introduction, the
documentation for sed is poor, but it's a really powerful tool if you can
find out how to use it.
Thi
Here. Reads from stdin and writes to stdout. Should do what you want.
Don't forget to make it executable. Save to a file, e.g. "type_munger.py"
then:
chmod +x type_munger.py
then:
./type_munger.py < input_file.txt > output_file.txt
Your line terminators, whatever they are (\n or \r\n or \r) are
st
> Type=0x21 Type=0x22 # Same as previous except
> Label= 2200 Label= 2200 # different value for Label
> blah, blahEndLevel=1
> blah, blah
>
> The bit that's got me stumped is how to handle the Label line. Can someone
> please give
I've got several large files that require some repetitive multiline search and
replace operations, and I feel sure that sed can do this, but I can't figure
out how to do it.
The pattern I'm searching for in the input file is "Type=0x21" followed by
"Label=abcde" on the next line, where abcde is
Phill Coxon wrote:
Steve sent me this which works great.
Thanks Nick & Rex for your suggestions to.
I can't resist posting another couple of options. In sed, it's a one-liner:
$ sed -e 's/.*/&\n"&"\n[&]/' infile > outfile
It's also possible to read line-by-line in a shell script without
messin
At 2004-06-30T123531+1200, Jim Cheetham wrote:
> Still, it sounds like another homework question to me. Is someone
> running through an "introduction to unix" course somewhere?
As part of the previously discussed renaming of the CLUG, perhaps we
need a slogan to go with the name...
"We're edGNUc
No homework. :)
I'm doing some work with Google Adwords at the moment.
Google Adwords provides different search responses based on whether the
search terms have quotes or square brackets.
search term - will match any search terms containing either of these
words
"search term" - will match on
At 2004-06-30T122050+1200, Nick Rout wrote:
> for line in $(cat $1) ; do
Assuming the input is your 'testin' file below, this will expand to:
for line in foo bar foo bar ; do
> unfortunately, and for reasons unknown to me it doesn't work properly
> on lines with a space in.
Once you realise wh
Nick Rout wrote:
for line in $(cat $1) ; do
echo $line
echo "["$line"]"
echo "*"${line}"*"
done
unfortunately, and for reasons unknown to me it doesn't work properly on
lines with a space in.
The reason is the IFS variable setting.
The $(cat $1) statement expands to a whole series of things, sepa
gt; wrote:
> Steve sent me this which works great.
>
> Thanks Nick & Rex for your suggestions to.
>
> -Forwarded Message-
> From: [EMAIL PROTECTED]
> To: Phill Coxon <[EMAIL PROTECTED]>
> Subject: Re: Help with sed
> Date: Wed, 30 Jun 2004 12:09:57 +120
Steve sent me this which works great.
Thanks Nick & Rex for your suggestions to.
-Forwarded Message-
From: [EMAIL PROTECTED]
To: Phill Coxon <[EMAIL PROTECTED]>
Subject: Re: Help with sed
Date: Wed, 30 Jun 2004 12:09:57 +1200
Hi Phill,
Try this...
8>< cut here 8>
On Wed, 30 Jun 2004 12:15:15 +1200
Phill Coxon <[EMAIL PROTECTED]> wrote:
> Not at all. :)
>
> On Wed, 2004-06-30 at 12:09, Nick Rout wrote:
> > does it have to be sed?
>
#!/bin/bash
for line in $(cat $1) ; do
echo $line
echo "["$line"]"
echo "*"${line}"*"
done
unfortunately, and for reason
Not at all. :)
On Wed, 2004-06-30 at 12:09, Nick Rout wrote:
> does it have to be sed?
Phill Coxon wrote:
Hey guys.
Can someone help me with a sed / bash script that takes an input file
and adds quotes and square brackets to the contents of each line,
outputting each variation to a new file?
i.e.:
Input file:
foo
bar
foo bar wizz bang
Output file:
foo
"foo"
[foo]
bar
"bar"
[bar]
does it have to be sed?
On Wed, 30 Jun 2004 12:05:09 +1200
Phill Coxon <[EMAIL PROTECTED]> wrote:
> Hey guys.
>
> Can someone help me with a sed / bash script that takes an input file
> and adds quotes and square brackets to the contents of each line,
> outputting each variation to a new file?
Hey guys.
Can someone help me with a sed / bash script that takes an input file
and adds quotes and square brackets to the contents of each line,
outputting each variation to a new file?
i.e.:
Input file:
foo
bar
foo bar wizz bang
Output file:
foo
"foo"
[foo]
bar
"bar"
[bar]
foo bar wizz ba
16 matches
Mail list logo