Discussion:
Problem with positional output
Michelle Konzack linux4michelle@gmail.com [sed-users]
2016-11-14 13:03:50 UTC
Permalink
Hello *,


after 4 years of Linux/OSS abstinence I am back and I run into troubles,
because I have forgotten ho to get values from a string...




The string has 4 parameters, deperated by the | sign and I like to get
it with something like


echo "${RETVAL}" |sed 's!(.*)|(.*)|(.*)!$1!'


but it does not work. also I have tried %1 and \1.


Can someone enlight me please?


Oh, i have sed1line.txt downloaded, but this info is not included.


Have a nice day/evening
--
Michelle Konzack ITSystems
GNU/Linux Developer 0033-6-61925193
Michelle Konzack linux4michelle@gmail.com [sed-users]
2016-11-14 13:09:17 UTC
Permalink
Grmpf!


Now I have to reply to myself!
Post by Michelle Konzack ***@gmail.com [sed-users]
Hello *,
after 4 years of Linux/OSS abstinence I am back and I run into troubles,
because I have forgotten ho to get values from a string...
The string has 4 parameters, deperated by the | sign and I like to get
it with something like
echo "${RETVAL}" |sed 's!(.*)|(.*)|(.*)!$1!'
This is now working with:


echo "${RETVAL}" |sed 's!\(.*\)|\(.*\)|\(.*\)!\1!'


Greetings
--
Michelle Konzack ITSystems
GNU/Linux Developer 0033-6-61925193
Sven Guckes maillists-yahoo@guckes.net [sed-users]
2016-11-14 14:20:32 UTC
Permalink
Post by Michelle Konzack ***@gmail.com [sed-users]
..I have forgotten ho to get values from a string...
The string has 4 parameters, seperated by the | sign
and I like to get it with something like
echo "${RETVAL}" |sed 's!(.*)|(.*)|(.*)!$1!'
echo "${RETVAL}" |sed 's!\(.*\)|\(.*\)|\(.*\)!\1!'
hmm..
so you basically want just the bginning of the data
and discard everything from the first pipe sign?

here is what i'd do in z-shell:

zsh> DATA='one|two|three|four'
zsh> echo ${DATA%%|*}
one

an example would be nice to see whether
we are talking about the same thing. ;)

Sven
Tim Chase sed@thechases.com [sed-users]
2016-11-14 14:34:03 UTC
Permalink
Post by Sven Guckes maillists-***@guckes.net [sed-users]
Post by Michelle Konzack ***@gmail.com [sed-users]
..I have forgotten ho to get values from a string...
The string has 4 parameters, seperated by the | sign
and I like to get it with something like
echo "${RETVAL}" |sed 's!(.*)|(.*)|(.*)!$1!'
echo "${RETVAL}" |sed 's!\(.*\)|\(.*\)|\(.*\)!\1!'
hmm..
so you basically want just the bginning of the data
and discard everything from the first pipe sign?
zsh> DATA='one|two|three|four'
zsh> echo ${DATA%%|*}
one
Sven's suggestion also works in bash and dash shells.

-tkc
Daniel Goldman dgoldman@ehdp.com [sed-users]
2016-11-14 16:59:34 UTC
Permalink
Yes, an example usually helps, prevents misinterpretation. I tried to
provide one:

$ cat example.txt
param 1|param 2|param 3|param 4

The suggested sed solution does not work correctly, as the first .* is
greedy and gobbles up the first '|' character:

$ sed 's!\(.*\)|\(.*\)|\(.*\)!\1!' example.txt
param 1|param 2

Adding one more 'hold pattern' works correctly, I think.

$ sed 's!\(.*\)|\(.*\)|\(.*\)|\(.*\)!\1!' example.txt
param 1

Instead of .* one could also use [^|]* expression.

Daniel
Post by Sven Guckes maillists-***@guckes.net [sed-users]
Post by Michelle Konzack ***@gmail.com [sed-users]
..I have forgotten ho to get values from a string...
The string has 4 parameters, seperated by the | sign
and I like to get it with something like
echo "${RETVAL}" |sed 's!(.*)|(.*)|(.*)!$1!'
echo "${RETVAL}" |sed 's!\(.*\)|\(.*\)|\(.*\)!\1!'
hmm..
so you basically want just the bginning of the data
and discard everything from the first pipe sign?
zsh> DATA='one|two|three|four'
zsh> echo ${DATA%%|*}
one
an example would be nice to see whether
we are talking about the same thing. ;)
Sven
------------------------------------
------------------------------------
------------------------------------

------------------------------------
--
------------------------------------

Yahoo Groups Links

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

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/sed-users/join
(Yahoo! ID required)

<*> To change settings via email:
sed-users-***@yahoogroups.com
sed-users-***@yahoogroups.com

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

<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/
Michelle Konzack linux4michelle@gmail.com [sed-users]
2016-11-14 20:35:38 UTC
Permalink
Good evening (or whatelse),
Post by Sven Guckes maillists-***@guckes.net [sed-users]
hmm..
so you basically want just the bginning of the data
and discard everything from the first pipe sign?
Not realy, because I need to seperate theoutput of "zenity" which return


VAL1|VAL2|VAL3
Post by Sven Guckes maillists-***@guckes.net [sed-users]
an example would be nice to see whether
we are talking about the same thing. ;)
LINK="$(echo ${RETURN} |sed 's!\(.*\)|\(.*\)|\(.*\)!\1!')"
FNAME="$(echo ${RETURN} |sed 's!\(.*\)|\(.*\)|\(.*\)!\2!')"
DIR="$(echo ${RETURN} |sed 's!\(.*\)|\(.*\)|\(.*\)!\3!')"


Which is now working fine.


Happy sed'ing
--
Michelle Konzack ITSystems
GNU/Linux Developer 0033-6-61925193
sharma__r@hotmail.com [sed-users]
2016-11-28 13:25:28 UTC
Permalink
Not realy, because I need to seperate theoutput of "zenity" which return> VAL1|VAL2|VAL3
LINK="$(echo ${RETURN} |sed 's!\(.*\)|\(.*\)|\(.*\)!\1!')"
FNAME="$(echo ${RETURN} |sed 's!\(.*\)|\(.*\)|\(.*\)!\2!')"
DIR="$(echo ${RETURN} |sed 's!\(.*\)|\(.*\)|\(.*\)!\3!')"
There are many issues with the above:
1. Running a command multiple times.
2. echo will behave incorrectly for certain values of $RETURN
3. $RETURN might contain globbing chars which might play truant since $RETURN is left unquoted.
4. if any of the VALs happen to contain trailing newlines then they shall be lost.
5. There is no need to quote the var=$(...) construct coz it's superfluous.




We can do something like the following:


set -f; IFS=\|; set -- $RETURN
case ${3++} in ?) LINK=$1 FNAME=$2 DIR=$3;;

'' ) echo >&2 "Error";; esac


N.B.: You should restore the IFS and set -f settings afterwards.



[Non-text portions of this message have been removed]
'Ruud H.G. van Tol' rvtol@isolution.nl [sed-users]
2016-11-28 15:31:14 UTC
Permalink
Post by ***@hotmail.com [sed-users]
Not realy, because I need to separate the output of "zenity" which return> VAL1|VAL2|VAL3
LINK="$(echo ${RETURN} |sed 's!\(.*\)|\(.*\)|\(.*\)!\1!')"
FNAME="$(echo ${RETURN} |sed 's!\(.*\)|\(.*\)|\(.*\)!\2!')"
DIR="$(echo ${RETURN} |sed 's!\(.*\)|\(.*\)|\(.*\)!\3!')"
1. Running a command multiple times.
2. echo will behave incorrectly for certain values of $RETURN
3. $RETURN might contain globbing chars which might play truant since $RETURN is left unquoted.
4. if any of the VALs happen to contain trailing newlines then they shall be lost.
5. There is no need to quote the var=$(...) construct coz it's superfluous.
set -f; IFS=\|; set -- $RETURN
case ${3++} in ?) LINK=$1 FNAME=$2 DIR=$3;;
'' ) echo >&2 "Error";; esac
N.B.: You should restore the IFS and set -f settings afterwards.
# In bash:

RET="VAL1|VAL2|VAL3"

if [[ $RET =~ ([^|]*)\|([^|]*)\|([^|]*) ]]
then
echo "${BASH_REMATCH[1]}:${BASH_REMATCH[2]}:${BASH_REMATCH[3]}";
fi

# which echoes:
#
# VAL1:VAL2:VAL3

-- Ruud

Cameron Simpson cs@zip.com.au [sed-users]
2016-11-15 22:33:30 UTC
Permalink
Post by Michelle Konzack ***@gmail.com [sed-users]
Post by Michelle Konzack ***@gmail.com [sed-users]
The string has 4 parameters, deperated by the | sign and I like to get
it with something like
echo "${RETVAL}" |sed 's!(.*)|(.*)|(.*)!$1!'
echo "${RETVAL}" |sed 's!\(.*\)|\(.*\)|\(.*\)!\1!'
By default sed uses Basic Regular Expressions, where \( and \) and needed for
grouping. Some seds (eg GNU sed) accept a -E option to enable Extended Regular
Expressions, where ( and ) are the syntax (and various other extra things
work).

Cheers,
Cameron Simpson <***@zip.com.au>
sharma__r@hotmail.com [sed-users]
2016-11-16 23:14:09 UTC
Permalink
Surprisingly , gnu sed --help doesn't showup the "-E" option while it does take it sed -E "..." without any errors.


BTW, the "-r" option is supposed to be doing this.


This definitely calls for an update of the GNU sed help options.
Post by Michelle Konzack ***@gmail.com [sed-users]
The string has 4 parameters, deperated by the | sign and I like to get
it with something like
echo "${RETVAL}" |sed 's!(.*)|(.*)|(.*)!$1!'
echo "${RETVAL}" |sed 's!\(.*\)|\(.*\)|\(.*\)!\1!'
By default sed uses Basic Regular Expressions, where \( and \) and needed for
grouping. Some seds (eg GNU sed) accept a -E option to enable Extended Regular
Expressions, where ( and ) are the syntax (and various other extra things
work).

Cheers,
Cameron Simpson <***@... mailto:***@...>



[Non-text portions of this message have been removed]
Amarendra Godbole amarendra_godbole@symantec.com [sed-users]
2016-11-16 23:17:11 UTC
Permalink
Linux man pages are known to lag behind and/or incorrect. Doesn¹t surprise
me, since most focus these days seems to add more and more code, who cares
for the manpages anyways? ;-)

-ag
Post by ***@hotmail.com [sed-users]
Surprisingly , gnu sed --help doesn't showup the "-E" option while it
does take it sed -E "..." without any errors.
BTW, the "-r" option is supposed to be doing this.
This definitely calls for an update of the GNU sed help options.
Post by Michelle Konzack ***@gmail.com [sed-users]
The string has 4 parameters, deperated by the | sign and I like to get
it with something like
echo "${RETVAL}" |sed 's!(.*)|(.*)|(.*)!$1!'
echo "${RETVAL}" |sed 's!\(.*\)|\(.*\)|\(.*\)!\1!'
By default sed uses Basic Regular Expressions, where \( and \) and needed for
grouping. Some seds (eg GNU sed) accept a -E option to enable Extended Regular
Expressions, where ( and ) are the syntax (and various other extra things
work).
Cheers,
[Non-text portions of this message have been removed]
------------------------------------
------------------------------------
--
------------------------------------
Yahoo Groups Links
Stephane Chazelas stephane.chazelas@gmail.com [sed-users]
2016-11-16 23:50:16 UTC
Permalink
Post by Amarendra Godbole ***@symantec.com [sed-users]
Linux man pages are known to lag behind and/or incorrect. Doesn¹t surprise
me, since most focus these days seems to add more and more code, who cares
for the manpages anyways? ;-)
[...]

This has nothing to do with Linux. We're talking of GNU sed
here. Linux has no sed command, it's just a kernel. There have
been several sed commands ported to Linux. The most common (in
terms of Linux-based system deployments in the wild) is probably
busybox' (think of embedded systems).

Busybox tools are usually shaped after their GNU equivalent
(with reduced functionality). -r was added there in 2004, and -E
in 2013 (and documented at the same time).

GNU systems (with a Linux kernel like Debian GNU/Linux, Fedora
or otherwise like Debian GNU/kFreeBSD) of course tend to ship
with GNU sed.
--
Stephane
Stephane Chazelas stephane.chazelas@gmail.com [sed-users]
2016-11-16 23:41:24 UTC
Permalink
Post by ***@hotmail.com [sed-users]
Surprisingly , gnu sed --help doesn't showup the "-E" option
while it does take it sed -E "..." without any errors.
BTW, the "-r" option is supposed to be doing this.
This definitely calls for an update of the GNU sed help options.
[...]

GNU sed came first with -r. Then, BSD added -E for the same
thing (which makes a lot more sense and is consistent with grep
for instance).

Then GNU grep added -E as a synonymous of -r for compatibility
with BSD but decided to leave it undocumented..

Then POSIX talked of specifying sed -E (likely to be in the next
major version).

Then GNU grep eventually documented -E (though there hasn't been
a new released since yet I beleive).
--
Stephane
Amarendra Godbole amarendra_godbole@symantec.com [sed-users]
2016-11-17 00:20:32 UTC
Permalink
I am not sure which BSD are you referring, but my OpenBSD 6.0 system does
document -E:

SED(1) General Commands Manual
SED(1)

NAME
sed - stream editor

SYNOPSIS
sed [-aEnru] [-i[extension]] command [file ...]
sed [-aEnru] [-e command] [-f command_file] [-i[extension]] [file ...]

DESCRIPTION
The sed utility reads the specified files, or the standard input if no
files are specified, modifying the input as specified by a list of
commands. The input is then written to the standard output.

A single command may be specified as the first argument to sed.
Multiple
commands may be specified separated by newlines or semicolons, or by
using the -e or -f options. All commands are applied to the input in
the
order they are specified regardless of their origin.

The options are as follows:

-a The files listed as parameters for the w function or flag are
created (or truncated) before any processing begins, by
default.
The -a option causes sed to delay opening each file until a
command containing the related w function or flag is applied
to a
line of input.

-E Interpret regular expressions using POSIX extended regular
expression syntax. The default behaviour is to use POSIX
basic
regular expression syntax.
Š

Thanks.

-ag
Post by Stephane Chazelas ***@gmail.com [sed-users]
Post by ***@hotmail.com [sed-users]
Surprisingly , gnu sed --help doesn't showup the "-E" option
while it does take it sed -E "..." without any errors.
BTW, the "-r" option is supposed to be doing this.
This definitely calls for an update of the GNU sed help options.
[...]
GNU sed came first with -r. Then, BSD added -E for the same
thing (which makes a lot more sense and is consistent with grep
for instance).
Then GNU grep added -E as a synonymous of -r for compatibility
with BSD but decided to leave it undocumented..
Then POSIX talked of specifying sed -E (likely to be in the next
major version).
Then GNU grep eventually documented -E (though there hasn't been
a new released since yet I beleive).
--
Stephane
------------------------------------
------------------------------------
--
------------------------------------
Yahoo Groups Links
------------------------------------

------------------------------------
--
------------------------------------

Yahoo Groups Links

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

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/sed-users/join
(Yahoo! ID required)

<*> To change settings via email:
sed-users-***@yahoogroups.com
sed-users-***@yahoogroups.com

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

<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/
sharma__r@hotmail.com [sed-users]
2016-11-17 00:45:59 UTC
Permalink
Now imagine that you were facing some trouble running some "sed" code; where would you turn to in such a scenario if not the manpages on your terminal? Or, that your OpenBSD 6.0 system for "sed" manpages is not updated and shows you features & options not in the version of sed you are actually running... won't that be a needless hindrance to the users?


The documentation better track the code for not being a roadblock to the users. In fact an uptodate doc is an asset to the productivity.



---In sed-***@yahoogroups.com, <***@...> wrote :

I am not sure which BSD are you referring, but my OpenBSD 6.0 system does
document -E:

SED(1) General Commands Manual
SED(1)

NAME
sed - stream editor

SYNOPSIS
sed [-aEnru] [-i[extension]] command [file ...]
sed [-aEnru] [-e command] [-f command_file] [-i[extension]] [file ...]

DESCRIPTION
The sed utility reads the specified files, or the standard input if no
files are specified, modifying the input as specified by a list of
commands. The input is then written to the standard output.

A single command may be specified as the first argument to sed.
Multiple
commands may be specified separated by newlines or semicolons, or by
using the -e or -f options. All commands are applied to the input in
the
order they are specified regardless of their origin.

The options are as follows:

-a The files listed as parameters for the w function or flag are
created (or truncated) before any processing begins, by
default.
The -a option causes sed to delay opening each file until a
command containing the related w function or flag is applied
to a
line of input.

-E Interpret regular expressions using POSIX extended regular
expression syntax. The default behaviour is to use POSIX
basic
regular expression syntax.
Å 

Thanks.

-ag
Post by Stephane Chazelas ***@gmail.com [sed-users]
Post by ***@hotmail.com [sed-users]
Surprisingly , gnu sed --help doesn't showup the "-E" option
while it does take it sed -E "..." without any errors.
BTW, the "-r" option is supposed to be doing this.
This definitely calls for an update of the GNU sed help options.
[...]
GNU sed came first with -r. Then, BSD added -E for the same
thing (which makes a lot more sense and is consistent with grep
for instance).
Then GNU grep added -E as a synonymous of -r for compatibility
with BSD but decided to leave it undocumented..
Then POSIX talked of specifying sed -E (likely to be in the next
major version).
Then GNU grep eventually documented -E (though there hasn't been
a new released since yet I beleive).
--
Stephane
------------------------------------
------------------------------------
--
------------------------------------
Yahoo Groups Links
[Non-text portions of this message have been removed]
Jim Hill gjthill@gmail.com [sed-users]
2016-11-17 00:38:54 UTC
Permalink
Post by ***@hotmail.com [sed-users]
Surprisingly , gnu sed --help doesn't showup the "-E" option while it does take it sed -E "..." without any errors.
That was fixed in 2013, see
http://git.savannah.gnu.org/gitweb/?p=sed.git;a=commit;h=8b65e07904384b529a464c89f3739d2e7e4d5135
. To be fair, there's been no version-tagged release since 2012.
sharma__r@hotmail.com [sed-users]
2016-11-16 23:24:18 UTC
Permalink
You could also do it without resorting to expensive backrefs, like as,

printf '%s\n' "$RETVAL" | sed -n 's/|/\n/;P'


---In sed-***@yahoogroups.com, <***@...> wrote :

Grmpf!


Now I have to reply to myself!
Post by Michelle Konzack ***@gmail.com [sed-users]
Hello *,
after 4 years of Linux/OSS abstinence I am back and I run into troubles,
because I have forgotten ho to get values from a string...
The string has 4 parameters, deperated by the | sign and I like to get
it with something like
echo "${RETVAL}" |sed 's!(.*)|(.*)|(.*)!$1!'
This is now working with:


echo "${RETVAL}" |sed 's!\(.*\)|\(.*\)|\(.*\)!\1!'


Greetings


--
Michelle Konzack ITSystems
GNU/Linux Developer 0033-6-61925193




[Non-text portions of this message have been removed]
Stephane Chazelas stephane.chazelas@gmail.com [sed-users]
2016-11-14 13:55:43 UTC
Permalink
2016-11-14 14:03:50 +0100, Michelle Konzack ***@gmail.com [sed-users]:
[...]
Post by Michelle Konzack ***@gmail.com [sed-users]
The string has 4 parameters, deperated by the | sign and I like to get
it with something like
echo "${RETVAL}" |sed 's!(.*)|(.*)|(.*)!$1!'
[...]

You don't have to use sed for that (which by the way wouldn't
work here if the "parameters" contain newline characters). You
can use the shell's (sh) split+glob operator:

IFS='|' # split on |
set -o noglob # disable glob
set -- $RETVAR # use split+glob to assign the $1, $2... parameters

printf '%s\n' "$1" # first parameter. You can't use echo for
# arbitrary data
--
Stephane
Jim Hill gjthill@gmail.com [sed-users]
2016-11-14 20:28:10 UTC
Permalink
I think Stephane's method is best, though I don't see the need for the
noglob here, I think

(IFS=\|; set -- $RETVAL; printf %s\\n "$3")

As an alternative if your data doesn't contain newlines, awk is
specialized for this,

awk -F\| '{print $3}' <<<"$RETVAL"

will do the same job.
Jim Hill gjthill@gmail.com [sed-users]
2016-11-14 21:36:14 UTC
Permalink
I don't see the need for the noglob here
oops.

(IFS=\|;set -f;set -- $RETVAL;printf %s\\n "$3")

as Stephane said. Should have listened to that little "are you sure?" voice.
sharma__r@hotmail.com [sed-users]
2016-11-16 23:19:36 UTC
Permalink
Actually you can do away with the quotes around the $3 also since we know that the pipe will never appear in $3 and hence
the split of an unquoted $3 won't happen. Also the set -f will
ensure that any globbing characters that happen to be in $3
will be left unexpanded.
I don't see the need for the noglob here
oops.

(IFS=\|;set -f;set -- $RETVAL;printf %s\\n "$3")

as Stephane said. Should have listened to that little "are you sure?" voice.




[Non-text portions of this message have been removed]
Stephane Chazelas stephane.chazelas@gmail.com [sed-users]
2016-11-15 12:47:23 UTC
Permalink
Post by Jim Hill ***@gmail.com [sed-users]
I think Stephane's method is best, though I don't see the need for the
noglob here, I think
(IFS=\|; set -- $RETVAL; printf %s\\n "$3")
No, the set -o noglob is needed here.

Using a variable unquoted in Bourne-like shells except zsh is
the split+glob operator.

Try with:

RETVAL='*|?|[a-z]'

For instance.

See also

https://unix.stackexchange.com/questions/171346/security-implications-of-forgetting-to-quote-a-variable-in-bash-posix-shells

More generally, when leaving a variable or other expansion
unquoted, you need to consider $IFS and the status of the noglob
option.
Post by Jim Hill ***@gmail.com [sed-users]
As an alternative if your data doesn't contain newlines, awk is
specialized for this,
awk -F\| '{print $3}' <<<"$RETVAL"
will do the same job.
Again, that retrieves the 3rd field of every line of $RETVAL, not
the 3rd field in $RETVAL.

If you're going to use that zsh <<< operator (though it's now
also supported by recent versions of ksh93 and bash), you could
as well use ${"${(@s:|:)REVAL}"[3]}.

s:|: splits on |
@ preserves empty elements within quotes
--
Stephane
sharma__r@hotmail.com [sed-users]
2016-11-16 23:16:34 UTC
Permalink
set -f is the short form for setting the noglob option.
Post by Jim Hill ***@gmail.com [sed-users]
I think Stephane's method is best, though I don't see the need for the
noglob here, I think
(IFS=\|; set -- $RETVAL; printf %s\\n "$3")
No, the set -o noglob is needed here.

Using a variable unquoted in Bourne-like shells except zsh is
the split+glob operator.

Try with:

RETVAL='*|?|[a-z]'

For instance.

See also

https://unix.stackexchange.com/questions/171346/security-implications-of-forgetting-to-quote-a-variable-in-bash-posix-shells https://unix.stackexchange.com/questions/171346/security-implications-of-forgetting-to-quote-a-variable-in-bash-posix-shells

More generally, when leaving a variable or other expansion
unquoted, you need to consider $IFS and the status of the noglob
option.
Post by Jim Hill ***@gmail.com [sed-users]
As an alternative if your data doesn't contain newlines, awk is
specialized for this,
awk -F\| '{print $3}' <<<"$RETVAL"
will do the same job.
Again, that retrieves the 3rd field of every line of $RETVAL, not
the 3rd field in $RETVAL.

If you're going to use that zsh <<< operator (though it's now
also supported by recent versions of ksh93 and bash), you could
as well use ${"${(@s:|:)REVAL}"[3]}.

s:|: splits on |
@ preserves empty elements within quotes

--
Stephane



[Non-text portions of this message have been removed]
Stephane Chazelas stephane.chazelas@gmail.com [sed-users]
2016-11-16 23:35:21 UTC
Permalink
Post by ***@hotmail.com [sed-users]
set -f is the short form for setting the noglob option.
[...]

Yes, though "set -f" means something different in zsh when not
in sh/ksh emulation. (set -f is not needed in zsh though when
not in sh/ksh emulation, and you'd neet set -- $=RETVAR for
splitting as split+glob is not implicit there).
sharma__r@hotmail.com [sed-users]
2016-11-17 00:54:31 UTC
Permalink
Thanks SC, I didn't know about the special case of "set -f" when not in sh emulate mode.
Post by ***@hotmail.com [sed-users]
set -f is the short form for setting the noglob option.
[...]

Yes, though "set -f" means something different in zsh when not
in sh/ksh emulation. (set -f is not needed in zsh though when
not in sh/ksh emulation, and you'd neet set -- $=RETVAR for
splitting as split+glob is not implicit there).



[Non-text portions of this message have been removed]
Amarendra Godbole amarendra_godbole@symantec.com [sed-users]
2016-11-17 00:17:39 UTC
Permalink
On my CentOS 7.2, sed --version shows ¡°GNU/sed 4.2.2¡±, and sed --help does
not show -E, but nevertheless accepts -E.

[OT]
As I said previously, the manpage is inaccurate, and so is the --help
switch. Yes, one can argue about names, but it doesn¡¯t change the fact -
call it Linux or GNU/Linux, or CentOS. Inaccurate manpages lead to buggy
application programs in my experience. The "gold standard" of manpages is
OpenBSD.
[/OT]

Thanks.

-ag
2016-11-16 23:17:11 +0000, Amarendra Godbole
Linux man pages are known to lag behind and/or incorrect. Doesn©öt
surprise
me, since most focus these days seems to add more and more code, who
cares
for the manpages anyways? ;-)
[...]
This has nothing to do with Linux. We're talking of GNU sed
here. Linux has no sed command, it's just a kernel. There have
been several sed commands ported to Linux. The most common (in
terms of Linux-based system deployments in the wild) is probably
busybox' (think of embedded systems).
Busybox tools are usually shaped after their GNU equivalent
(with reduced functionality). -r was added there in 2004, and -E
in 2013 (and documented at the same time).
GNU systems (with a Linux kernel like Debian GNU/Linux, Fedora
or otherwise like Debian GNU/kFreeBSD) of course tend to ship
with GNU sed.
--
Stephane
------------------------------------
------------------------------------
Loading...