Quote:
Originally Posted by souchai
how do I write a the command line “last –wi > mylogin” to create a file called mylogin that shows all login information on sp-cfsics.um.com since “Jan 24,” and then write an awk script, myawk, to determine how many lines in mylogin contain the string “cis264fs1702”.
|
How far back does
wtmp go? You may have to query some of the older files, too. Using
last with the -F option will give you the full date and time of each login.
Once you've figured out how to use
last to get what you need, I'd recommend using a pipe | to send the data to
awk instead of using temporary files. If your assignment requires using temporary files, then
tempfile is the safe and reliable way to chose a name.
How far have you gotten with
awk and where are you stuck? You need to use the END { } stanza to print your sum. See these two resources:
https://www.ibm.com/developerworks/library/l-awk1/
http://www.grymoire.com/Unix/Awk.html#uh-1