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

Cut

I've removed advertising from most of this site and will eventually clean up the few pages where it remains.

While not terribly expensive to maintain, this does cost me something. If I don't get enough donations to cover that expense, I will be shutting the site down in early 2020.

If you found something useful today, please consider a small donation.



Some material is very old and may be incorrect today

© November 2003 Tony Lawrence

Having used Unix since before "cut" was apt to be on the machine, I'm used to using "sed" to extract what I want from a line, but "cut" is much easier:


 apl$ cut -d : -f 5 /etc/passwd
Unprivileged User
System Administrator
System Services
Unknown User
Sendmail User
World Wide Web Server
MySQL Server
sshd Privilege separation
Anthony Lawrence
 

Now that's not fun with sed.

Cut can also use character positions:

cut -c 1-8  /etc/passwd
nobody:*
root:*:0
daemon:*
unknown:
smmsp:*:
www:*:70
mysql:*:
sshd:*:7
apl:*:50
 

If you found something useful today, please consider a small donation.



Got something to add? Send me email.





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

Printer Friendly Version

->
-> cut


Inexpensive and informative Apple related e-books:

Take Control of Pages

El Capitan: A Take Control Crash Course

Take Control of High Sierra

Take Control of iCloud, Fifth Edition

Digital Sharing Crash Course





More Articles by © Tony Lawrence



You can also use the substr function of expr to extract string data.

--BigDumbDinosaur



Printer Friendly Version

Have you tried Searching this site?

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


Printer Friendly Version





Science is what we understand well enough to explain to a computer. Art is everything else we do. (Donald Knuth)




Linux posts

Troubleshooting posts


This post tagged:

Scripting

Shell

UnixWords



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode