Reading a file, with a bit of a twist to it
I'm writing a script that reads from a file. Here is an example of what the file looks like.
username1 24-Mar-10.19:47:21 /directorytheyworkedon Some comment username2 24-Mar-10.19:46:40 /directorytheyworkedon Some comment username3 24-Mar-10.19:43:44 /directorytheyworkedon Some comment Now what I want to do is pull out only the usernames and put them into a list. After I intend to email each user individually and tell them what directory they worked on, their comment, and the date. The road block I ran into is I can't figure out how to differentiate between the line with the usernames, and the line with the comments. Any suggestions would be greatly appreciated. |
Hi dragonandante,
Awk, if you didn't know, is the best program in the command-line world. Today Awk is going to save your ass: Code:
awk ' Code breakdown: Code:
!/.+[0-3][0-9]-[A-Z][a-z][a-z]-/ { Code:
{ Happy Awk'ing. |
Hi,
Welcome to LQ! Quote:
It would be easier to aid you if the problem was defined better along with what you have attempted. Just a few links to aid you; Linux Documentation Project Rute Tutorial & Exposition Linux Command Guide Utimate Linux Newbie Guide LinuxSelfHelp Getting Started with Linux Bash Reference Manual <<<<< Advanced Bash-Scripting Guide <<<<<< Linux Home Networking Virtualiation- Top 10 :hattip: The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links! |
Many thanks for the help and the links. I'll be sure to throw down my deeds in the future.
|
All times are GMT -5. The time now is 04:20 PM. |