bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Just want to exclude lines with tabs


From: xyz2041
Subject: Re: Just want to exclude lines with tabs
Date: Thu, 19 May 2016 22:19:45 -0500

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 <address@hidden> 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
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]