logo       

Re: Stingily extracting a block of lines: msg#00021

editors.sed.user

Subject: Re: Stingily extracting a block of lines

kaushik.m@xxxxxxx wrote:
> Hi,

Good morning, Kaushik.

Let's see if I understand your version...

# This {...} grouping appears to be redundant
{

# For all lines from the first "bundle" to the very end
# of the data set...
# (Why not to the first ".elm"?)
bundle,${
# Exchange the contents of the hold and pattern spaces.
# Ie save the current line of data for later and
# operate on the saved data.
x
# Append the contents of the hold space to the pattern space.
# Ie, append the current line of data to the store
# of all data from that first "bundle".
G
# Replace all '\n' characters with '|'.
# Why? You're making an assumption about the input data set that
# is totally unwarranted. It's also an unnecessary substitution.
s/\n/|/g

# On the last line of the data set.
${
# Hmmmmm. Now I'm really nervous.
# Is this '[^[.bundle.]]' construct legal POSIX sed?
s/[^[.bundle.]]*\(.*\.elm\).*/\1/g

# Replace all '|' chars with '\n's. So what about any '|'
# chars that were in the original data set?
s/|/\
/g

# Print this manipulation.
p
}

# Append the current line of pattern space into the hold space
h
}
}

Well, I see what your script does, but it's making extra assumptions about
the contents of the dataset. That's fine because you don't actually need
to remove the '\n' chars at all. However, the killer it that my version of
sed complains long and loud about that collation block:

sed: file trial.sed line 8: Invalid collation character

Regards,
Angus



------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/2jUsvC/tzNLAA/TtwFAA/dkFolB/TM
--------------------------------------------------------------------~->

--

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/sed-users/

<*> To unsubscribe from this group, send an email to:
sed-users-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/






<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise