[Ilugc] Error in awk script
- From: karthick.sundararajan@xxxxxxxxx (karthick.sundararajan@xxxxxxxxx)
- Date: Thu Aug 26 16:00:04 2004
Thanks.
It is working.
Thanks for the scripts too.
Cheers,
Karthick S.
Wipro Technologies - Chennai
Mobile Number: 9884025911
Home Page: www.geocities.com/sksatyam
-----Original Message-----
From: ilugc-bounces@xxxxxxxxxxxxx [mailto:ilugc-bounces@xxxxxxxxxxxxx]
On Behalf Of Shakthi Kannan
Sent: Thursday, August 26, 2004 15:38
To: ilugc@xxxxxxxxxxxxx
Subject: Re: [Ilugc] Error in awk script
Hi!
My awk code was:
$ awk ' { if ( length($0) > 80 ) { printf $FILENAME,
$NR, "\n"} } ' *.c
/tmp/code
Try this:
#!/bin/bash
#Script: len.sh
#Pass the directory as an argument to script
if [$# -ne 1]; then
echo "Usage: len [directory]"
exit 1
fi
for file in `ls $1`; do
awk 'length($0) > 80 {print FILENAME, NR, $0, "\n"}'
$file
done
I will really encourage you to go through some online
awk tutorials:
An AWK Tutorial:
http://www.vectorsite.net/tsawk.html
AWK Tutorial:
http://stud.wsi.edu.pl/~robert/awk/
Guided tour of awk:
http://www.vectorsite.net/tsawk1.html
Regards,
Shaks
=====
------------------------------------------------------------------------
--
Gentoo Linux 1.4 (2.6.5-mm1) / FreeBSD Unix 4.9 - Pentium M 1.40GHz -
512 MB - 40 GB - 14" - 4.5-4.9 lbs - CD-RW/DVD-ROM - Intel PRO/1000
Gigabit Ethernet - Intel PRO/Wireless Network Connection 802.11b
http://www.geocities.com/shakthimaan
------------------------------------------------------------------------
--
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush
_______________________________________________
To unsubscribe, email ilugc-request@xxxxxxxxxxxxx with
"unsubscribe <password> address"
in the subject or body of the message.
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
Confidentiality Notice
The information contained in this electronic message and any attachments to
this message are intended
for the exclusive use of the addressee(s) and may contain confidential or
privileged information. If
you are not the intended recipient, please notify the sender at Wipro or
Mailadmin@xxxxxxxxx immediately
and destroy all copies of this message and any attachments.
Other related posts: