Account Links: Cart | Your Account | Logout

Skip to content

Red Hat Knowledgebase

Red Hat Knowledgebase Search:

Updated Within the Last:

New Solutions within the last day New Solutions within the last week New Solutions within the last month

Browse by topics:


Click to View a Topic
Red Hat Enterprise Linux > AS/ES/WS Basics > Issue <<  325 of 908 >>

Solution Tools:


Email a Solution Postcard Printer version Submit a comment on this answer Update notifications Request an answer Back

Article Reference

Article ID: 4345
Last update: 11-22-04
Issue:
Is there an easy way to process delimited files?
Resolution:
Delimited files are text files that use some sort of special characters, usually a TAB or comma, to separate fields of a record. If you need to extract some fields but not others try using the cut command.

Using cut, you can extract one or many contiguous or non-contiguous fields from a delimited file. For example, to extract just the username and the shell from the /etc/passwd file (the first and seventh fields), use the following command:
cut -d ':' -f 1,7 /etc/passwd
The following output is displayed:

 
root:/bin/bash
bin:/sbin/nologin
daemon:/sbin/nologin
adm:/sbin/nologin
lp:/sbin/nologin
sync:/bin/sync
shutdown:/sbin/shutdown
halt:/sbin/halt
mail:/sbin/nologin
news:
uucp:/sbin/nologin
operator:/sbin/nologin
games:/sbin/nologin
gopher:/sbin/nologin
ftp:/sbin/nologin
nobody:/sbin/nologin
dbus:/sbin/nologin
vcsa:/sbin/nologin
nscd:/sbin/nologin
rpm:/sbin/nologin
haldaemon:/sbin/nologin
netdump:/bin/bash
sshd:/sbin/nologin
rpc:/sbin/nologin
rpcuser:/sbin/nologin
nfsnobody:/sbin/nologin
mailnull:/sbin/nologin
smmsp:/sbin/nologin
pcap:/sbin/nologin
....
   


For more information on the cut command, consult the man page for cut by typing man cut from the command line.


How well did this entry answer your question?


good wrong incomplete out of date
Red Hat Enterprise Linux > AS/ES/WS Basics > Issue <<   325  of  908  >>