Can use some help with a linux/UNIX question using awk scripting please Consider
ID: 3796628 • Letter: C
Question
Can use some help with a linux/UNIX question using awk scripting please
Consider the address book below:
$ cat addr
Xiao Li, lxiao@unc.edu, 6705462234, Jackson, NC 764
Natkin William, wnatkin@imap28.vcu.edu, 8044344528, Richmond, VA 22345 Elizi Moe, emoe@ncsu.edu, 5208534566, Tempe, AZ 85282
Ma Ta, mta@yahoo.com, 4345667345, Austin, TX 91030
Diana Cheng, dcheng@asu.edu, 5203456789, Matitsi, WY 4587
Jackson Five, jfive@ncsu.edu, 5206564573, Kyenta, AZ 85483
Adi SrikanthReddy, sadi1@imap1.asu.edu, 6578904566, Wyo, WS 67854
Write an awk script called activity6.1-5.awk to display the 2 fields whose numbers are assigned from the command line.
In the BEGIN block, include statements to display the following:
Today’s date is <date and time from script goes here>
The value assigned to the first variable is: <value> The value assigned to the second variable is: <value>
Explanation / Answer
#!/usr/bin/nawk -f
BEGIN{
now=$(date);
print "Today’s date is $now"
print "The value assigned to the first variable is:$1 The value assigned to the second variable is: $2"
}
save above in activity6.1-5.awk file and the execute using awk command
awk activity6.1-5.awk 5 6
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.