Re: sed and grep stopped working!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17Aug2018 00:17, Todd Chester <ToddAndMargo@xxxxxxxx> wrote:
grep and sed stopped working!  I dnf re-installed them
both. No joy

What the heck (not my "actual" word)?
[...]

Next time this happens consider snapshotting the output at various points:

 $ echo "a-b-c" | tee echo.out | ( set -x; sed -e 's/-//g' ) 2>sed-trace.out | tee sed.out
 <nothing>

Then "od -c" the echo.out and sed-trace.out and sed.out files.

There's all sorts of possibilities, including the "-" not being an ASCII minus and weird escape sequences hiding the output, not to mention possible stdio bugs in sed or grep - I certainly came across one in GNU sed several years ago for input data.

Just something to keep in mind for later.

Cheers,
Cameron Simpson <cs@xxxxxxxxxx>


$ echo "a-b-c" | sed -e 's/-//g'
<nothing>

Workaround:
   $ echo "a-b-c" | perl -pe 's/-//g'
   abc

   $ echo "a-b-c" | perl6 -pe 's:g/\-//'
   abc



$ ls -al /tmp | sed -n 3,4p
<nothing>

Workaround:
   $  ls -al /tmp  | perl6 -ne ".say if 3 <= ++$ <= 4"
   dr-xr-xr-x. 19 root root    278 Apr 11 20:43 ..
   drwxr--r--.  2 todd users    40 Aug 17 00:08 ARI

   $ x=3; y=4; ls -al /tmp  | perl6 -ne ".say if $x <= ++$ <= $y"
   dr-xr-xr-x. 19 root root    278 Apr 11 20:43 ..
   drwxr--r--.  2 todd users    40 Aug 17 00:08 ARI



# echo "abc" | grep  "ab"
<nothing>

Work around:
   $ echo "abc" | ack "ab"
   abc
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx/message/RG6O4SM24MHTTYZDGM2OIUMSFTJZDMZD/



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux