Re: Just want to exclude lines with tabs
xyz2041 <[email protected]> Thu, 19 May 2016 22:19:45 -0500
| Newsgroups | gmane.comp.gnu.utils.bugs |
|---|---|
| Message-ID | <CAAY=KgMiwZXmieoi-rRyY9QoLE=u6YUXRSg_kJd9WmsE+nMi6w@mail.gmail.com> |
Thanks, everyone. I just couldn't get Windows command line to let me put a tab on the line, so I wrote a batch file: set TAB= grep -v "%TAB%" %1.%2 > %1-NoTabs.csv grep -v "," %1.%2 > %1-NoCmas.tab Just hit the tab key after "set TAB=". Not elegant but it works. grep version: K:\>grep -V grep (GNU grep) 2.5.1 Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MD5: bb350a9ac2236b3e29f2229e77709f40 Thanks, again! On 5/19/16, Karl Berry <[email protected]> wrote: > grep "$(printf '\t')" o.csv > > It seems to me this should have worked, unless your shell's quoting got > rid of the \ before printf could see it. Certainly this works: > > tab=`printf '\t'` # or $(...), whatever > grep "$tab" somefile > > This assignment of special characters to shell variables and then using > the variable in subsequent commands is the most portable (across decades > and "improvements" in standards, shells, systems, ...) approach I know > of. FWIW. -k > >