Walt Pawley wrote:
wump$ time sed s/ .*// Desktop/klog kadr1
Note that this is a job for cut(1):
$ cut -d -f1 input
Interestingly, the fastest way to do that job is to use
a regular expression with Python. This is about twice
as fast as the proposed perl solution:
$ python -c 'import re;
On Sat, 2008-08-23 at 15:16 -0700, Walt Pawley wrote:
At 10:01 AM +0100 8/23/08, Matthew Seaman wrote:
Walt Pawley wrote:
At the risk of beating this to death, I just happened to
stumble on a real world example of why one might want to use
Perl for sed-ly stuff.
... snip ...
wump$
Walt Pawley wrote:
At 9:59 AM +0200 8/22/08, Oliver Fromme wrote:
wump$ ls -l Desktop/klog
-rw-r--r-- 1 wump 1001 52753322 22 Aug 16:37 Desktop/klog
wump$ time sed s/ .*// Desktop/klog kadr1
real0m10.800s
user0m10.580s
sys 0m0.250s
wump$ time perl -pe 's/ .*//'
Walt Pawley wrote:
At 9:59 AM +0200 8/22/08, Oliver Fromme wrote:
- The perl command you wrote above is pretty much a sed
command anyway (except you incorrectly used non-portable
regular expression syntax). Why use perl to execute a
sed command?
At the risk of beating this to death, I
At 10:01 AM +0100 8/23/08, Matthew Seaman wrote:
Walt Pawley wrote:
At the risk of beating this to death, I just happened to
stumble on a real world example of why one might want to use
Perl for sed-ly stuff.
... snip ...
wump$ ls -l Desktop/klog
-rw-r--r-- 1 wump 1001 52753322 22 Aug
Walt Pawley wrote:
Walt Pawley wrote:
Walt Pawley wrote:
Steve Bertrand wrote:
- read email addresses from a file in the format:
user.name TAB domain.tld
- convert it to:
[EMAIL PROTECTED]
- write it back to either a new file, the original
Oliver Fromme wrote:
Walt Pawley wrote:
I guess getting old, nearly blind and mind numbing close to
brain dead is better than the alternative. Try this (sooner or
later I've got to get it right)...
perl -pe 's/(.*?)\.(.*)\t.*/[EMAIL PROTECTED]/' input_file output_file
I
At 9:59 AM +0200 8/22/08, Oliver Fromme wrote:
- The perl command you wrote above is pretty much a sed
command anyway (except you incorrectly used non-portable
regular expression syntax). Why use perl to execute a
sed command?
At the risk of beating this to death, I just happened to
I'm frequently having to modify/convert email addresses from one
format/domain to another.
Usually, I slap together a quick Perl script to do this for me. I don't
do it frequently enough to keep track which one of my scripts does this
for me, so I'm continuously re-inventing the wheel.
Some
Steve Bertrand wrote:
To put it plainly, can anyone, if it's possible, provide a single line
sed/awk pipeline that can:
To answer my own post, I found in some past notes something I drummed up
quite a while ago that I can most certainly modify to suit my needs:
# Cat the tcpdump output
Quoting Steve Bertrand [EMAIL PROTECTED]:
few passes over a few files.
To put it plainly, can anyone, if it's possible, provide a single
line sed/awk pipeline that can:
- read email addresses from a file in the format:
user.name TAB domain.tld
- convert it to:
[EMAIL PROTECTED]
-
On Thu, Aug 21, 2008 at 08:46:47AM -0400, Steve Bertrand wrote:
I'm frequently having to modify/convert email addresses from one
format/domain to another.
Usually, I slap together a quick Perl script to do this for me. I don't
do it frequently enough to keep track which one of my scripts
Barry Byrne wrote:
Quoting Steve Bertrand [EMAIL PROTECTED]:
few passes over a few files.
To put it plainly, can anyone, if it's possible, provide a single line
sed/awk pipeline that can:
- read email addresses from a file in the format:
user.name TAB domain.tld
- convert it to:
[EMAIL
Joseph Olatt wrote:
Try the following:
cat t.txt | awk -F\t '{split($1, arr, .); printf([EMAIL PROTECTED], arr[
1], arr[2], $2);}'
where t.txt:
john.doeexample.com
This did the job, the only modification I needed to make was manually
replace $2 with the string of the domain I needed
El día Thursday, August 21, 2008 a las 05:54:29AM -0700, Joseph Olatt escribió:
Try the following:
cat t.txt | awk -F\t '{split($1, arr, .); printf([EMAIL PROTECTED], arr[
1], arr[2], $2);}'
where t.txt:
john.doeexample.com
Despite of the magic awk(1) or while-loops: this is all
Matthias Apitz wrote:
El día Thursday, August 21, 2008 a las 05:54:29AM -0700, Joseph Olatt escribió:
Try the following:
cat t.txt | awk -F\t '{split($1, arr, .); printf([EMAIL PROTECTED], arr[
1], arr[2], $2);}'
where t.txt:
john.doeexample.com
Despite of the magic awk(1) or
cat tcpdump.txt | awk '{if ($3 != 192.168.100.204.25) print $3}' | \
awk '{FS = .} {print $1,.,$2,.,$3,.$4}' | sed s/ //g
why you all abuse cat command. simply awk tcpdump.txt
Steve
___
freebsd-questions@freebsd.org mailing list
Regards,
cat file.txt | ( while read user domain; do echo [EMAIL PROTECTED]; done )
second cat abuser
while read user domain; do echo [EMAIL PROTECTED]; done file.txt
___
freebsd-questions@freebsd.org mailing list
Try the following:
cat t.txt | awk -F\t '{split($1, arr, .); printf([EMAIL PROTECTED], arr[
1], arr[2], $2);}'
and third
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send
...but that is just semantics, relative to the intent and purpose of this
no. using cat make one more pipe, one more process and is noticably slower
___
freebsd-questions@freebsd.org mailing list
Wojciech Puchar wrote:
Try the following:
cat t.txt | awk -F\t '{split($1, arr, .); printf([EMAIL PROTECTED], arr[
1], arr[2], $2);}'
and third
If you have nothing nice to say, or can't contribute or point out more
efficient ways of doing things in a polite manner, then 'don't say
If you have nothing nice to say, or can't contribute or point out more
this is a contribution. unless you can't see it.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send
Wojciech Puchar wrote:
...but that is just semantics, relative to the intent and purpose of this
no. using cat make one more pipe, one more process and is noticably slower
Yes it's agreed...
I was joking around with Matthias for kind-heartedly pointing out the
err of our ways.
Steve
On Thu, Aug 21, 2008 at 09:17:43AM -0400, Steve Bertrand wrote:
Wojciech Puchar wrote:
Try the following:
cat t.txt | awk -F\t '{split($1, arr, .); printf([EMAIL PROTECTED],
arr[
1], arr[2], $2);}'
a shorter way:
sed s/\\./_/g inputfile | awk '{print $1 @example.com}' outputfile
Anton Shterenlikht wrote:
On Thu, Aug 21, 2008 at 09:17:43AM -0400, Steve Bertrand wrote:
Wojciech Puchar wrote:
Try the following:
cat t.txt | awk -F\t '{split($1, arr, .); printf([EMAIL PROTECTED], arr[
1], arr[2], $2);}'
a shorter way:
sed s/\\./_/g inputfile | awk '{print $1
On Thursday 21 August 2008 16:19:08 Wojciech Puchar wrote:
If you have nothing nice to say, or can't contribute or point out more
this is a contribution. unless you can't see it.
There are assumptions that combining more than three
cats (*) in a pipeline, the universe will explode!
(*) That
On Thu, 2008-08-21 at 15:12 +0200, Wojciech Puchar wrote:
cat tcpdump.txt | awk '{if ($3 != 192.168.100.204.25) print $3}' | \
awk '{FS = .} {print $1,.,$2,.,$3,.$4}' | sed s/ //g
why you all abuse cat command. simply awk tcpdump.txt
Why do you abuse redundant input redirection?
Steve Bertrand wrote:
To put it plainly, can anyone, if it's possible, provide a single line
sed/awk pipeline that can:
- read email addresses from a file in the format:
user.name TAB domain.tld
- convert it to:
[EMAIL PROTECTED]
With awk(1):
awk '{sub(/\./, _, $1);
On Thu, 21 Aug 2008 15:49:17 +0200 (CEST)
Oliver Fromme [EMAIL PROTECTED] wrote:
To put it plainly, can anyone, if it's possible, provide a single
line sed/awk pipeline that can:
- read email addresses from a file in the format:
user.name TAB domain.tld
- convert it to:
At 8:46 AM -0400 8/21/08, Steve Bertrand wrote:
- read email addresses from a file in the format:
user.name TAB domain.tld
- convert it to:
[EMAIL PROTECTED]
- write it back to either a new file, the original file, or to STDOUT
I'm curious why Perl isn't a decent choice. I think I'd do
At 3:49 PM -0700 8/21/08, Walt Pawley wrote:
At 8:46 AM -0400 8/21/08, Steve Bertrand wrote:
- read email addresses from a file in the format:
user.name TAB domain.tld
- convert it to:
[EMAIL PROTECTED]
- write it back to either a new file, the original file, or to STDOUT
I'm curious why
At 4:19 PM -0700 8/21/08, Walt Pawley wrote:
At 3:49 PM -0700 8/21/08, Walt Pawley wrote:
At 8:46 AM -0400 8/21/08, Steve Bertrand wrote:
- read email addresses from a file in the format:
user.name TAB domain.tld
- convert it to:
[EMAIL PROTECTED]
- write it back to either a new file, the
32 matches
Mail list logo