APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Replace 10th tab

If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):

Subject: Re: Shell script question.
References: <8d58e154.0112260154.61df2a30@posting.google.com>
From: spcecdt@deeptht.armory.com (John DuBois)
Date: 27 Dec 2001 00:22:27 GMT

In article <8d58e154.0112260154.61df2a30@posting.google.com>,
Filip Verborgh <filip.verborgh@fidro-zedelgem.be> wrote:
>I would like to replace the 10th TAB (separator between field 10 and
>field 11) by another character (eg. "-").

If you have a recent version of gawk (I forget which version gensub() appeared
in), this can be done in a particularly straightforward manner:

gawk '{print gensub("\t","-",10)}'

"replace the 10th instance of tab with '-' and print the result"

John DuBois  spcecdt@armory.com  KC6QKZ/AE  http://www.armory.com/~spcecdt/

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Replace 10th tab ––>Re: Shell script question.

Increase ad revenue 50-250% with Ezoic

Kerio Samepage

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

The teaching of BASIC should be rated as a criminal offence: it mutilates the mind beyond recovery. (Edsger W. Dijkstra)

This post tagged: