1

I am using a mac and I have a CSV file delimited by tabs. I want to just remove all the content between the 2nd and 3rd tabs or replace it with something like "XXXX". Is there a command for this?

bigpotato
  • 275
  • 1
  • 3
  • 10
  • The quickest way would be using a text editor that allows vertical selection (sublime, text mate), but I'm guessing you want to do this from the command line, in which case sed is your friend – spuder Jul 30 '13 at 19:20
  • @spuder, vim can do vertical selection too, but in this case the fields may not be aligned. Can editors deal with that? A spreadsheet would be more straightforward. – Paulo Almeida Jul 30 '13 at 21:00

2 Answers2

1

Try awk

awk '{$3="XXXXX"; print $0}' infile > newfile
1

Using cut:

cut --complement -f 2-3 <file>
Paulo Almeida
  • 746
  • 3
  • 4