HI,
In message "UNIX pipes"
on 02/06/14, "David Douthitt" <DDouthitt / cuna.coop> writes:
|@snaptime = `/usr/contrib/bin/gunzip -lv #{file} | /usr/bin/sed 's/^[^ ]* [^ ]* \(... .. ..:..\).*/\1/'`.chomp
|p @snaptime
|
|...and it should (to me, anyway) return:
|
|"Jun 12 13:54"
|
|...instead of the odd result of:
|
|"\001"
|
|What gives? That's not a returned error code, is it?
`` eats your backslashes, so that it passes sed
\( -> (
\) -> )
\1 -> \001
which are not what you want. Try
@snaptime = `/usr/contrib/bin/gunzip -lv #{file} | /usr/bin/sed 's/^[^ ]* [^ ]* \\(... .. ..:..\\).*/\\1/'`.chomp
matz.