Berkeley CSUA MOTD:Entry 21039
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/24 [General] UID:1000 Activity:popular
5/24    

2001/4/20-22 [Computer/SW/Unix] UID:21039 Activity:moderate
4/20    How come sed -e 's/[\ \t\n]/ /g' doesn't work for the tab and \n?
        \_ obUsePerl
           perl -pe 's/[\s\n]/ /g'
           \_ perl -pe 's/\s/ /g' is sufficient --dbushong
        \_ This is ugly, but it works for tab:
           sed -e 's/'"`echo \"\t\"`"'/ /g'
           Oh, and what's the point of matching SPACE, TAB, and NEWLINE
           instead of just TAB and NEWLINE? Replacing SPACE with SPACE?
                \_ you mean /bin/echo right? echo (shell command) wouldn't
                   work. Also maybe the guy means 's/[\s]+/ /g'
                   \_ yup, /bin/echo or /usr/bin/echo