Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > gnu.utils.bug > #2211

Re: Just want to exclude lines with tabs

From xyz2041 <xyz2041@gmail.com>
Newsgroups gnu.utils.bug
Subject Re: Just want to exclude lines with tabs
Date 2016-05-19 22:19 -0500
Message-ID <mailman.195.1463714391.6543.bug-gnu-utils@gnu.org> (permalink)
References <CAAY=KgOd0CYkx43xZ7WQ1SFj3mABziKEiueN6JohZvHM0rin5Q@mail.gmail.com> <201605192121.u4JLLI4b005478@freefriends.org>

Show all headers | View raw


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 <karl@freefriends.org> 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
>
>

Back to gnu.utils.bug | Previous | NextNext in thread | Find similar


Thread

Re: Just want to exclude lines with tabs xyz2041 <xyz2041@gmail.com> - 2016-05-19 22:19 -0500
  Re: Just want to exclude lines with tabs Manuel Collado <mcollado@domain.invalid> - 2016-05-20 18:54 +0200

csiph-web