Linux Today: Linux News On Internet Time.
Search Linux Today
search.internet.com
Linux News Sections:  Blog -  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Preferences
Contribute
Link to Us
Search
Linux Jobs

Become a Marketplace Partner

internet.commerce
Be a Commerce Partner














The Linux Channel at internet.com
Linux Today
Enterprise Linux Today
Apache Today
JustLinux.com
Linux Planet
PHPBuilder
All Linux Devices
Technology Jobs

JustTechJobs.com

LinuxToday Newsletters
Subscribe News
Subscribe PR
Subscribe Security

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

 






Current Newswire:

HP Launches First Quad-Core Itanium Systems

Dell Ubuntu Order Experience

Power Up Linux GUI Apps

Ksplice debuts zero downtime service for Linux

BM Ups Its Processor Power to 7

KDE.org Relaunched for Software Compilation 4.4

The application is the new the operating system

Linux can compete with the iPad on price, but where’s the magic?

The Bruno Knaapen Technology Learning Center is Established

Anjal: GNOME's Evolution for Netbooks




UNIX Systems Administrator (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume
:Bash Tricks II: Repetitive tasks on files
Bash Tricks II: Repetitive tasks on files
Jun 7, 2009, 14 :02 UTC (0 Talkback[s]) (4921 reads)

(Other stories by Edmundo Carmona)

[ Thanks to Edmundo for this link. ]

"Second we have the while read variable; do x; y; z; done. This construct allows us to read from the standard output line by line placing the content of each line in a variable (multiple variables can be used, in that case a single word from the standard input will be placed in each variable). In our case, we used $filename as our variable (be careful not to use $ on the while read).

"Then the ``s. These kids allow us to run a command so that its output can be assigned. In our case, we are listing the files of a tgz file, grepping to find the pattern of the file we are looking for and then counting the lines that come out of grep. The number of lines is what is saved in the variable $lines."

Complete Story

Related Stories:
Some Howtos: A whole batch from TuxMachines.org(May 30, 2009)
Switch to the Command line, Part 1(May 27, 2009)
Speak UNIX fluently with the best tools available(May 15, 2009)
Use the Bash trap Statement to Clean Up Temporary Files(May 12, 2009)
Command line made easy: five simple recipes for grep(May 06, 2009)
The Tiny Unix And Linux Shell Crash Course For Beginners(May 01, 2009)
/dev/null And /dev/zero On Linux And Unix: What's The Difference?(Apr 29, 2009)
The Bash declare Statement(Apr 29, 2009)



No talkbacks posted.
  Home | Search Talkbacks | Customize View    Top of Page  



Enter your comments below:

* Your Name:

* Your Email Address:

* Subject:

CC: [will also send this talkback to an E-Mail address]

* Comments:

Tags allowed:<I>,<B> and <U>. See our talkback-policy for more about talkback content.

Fields marked with * are required!






..............................




All times are recorded in UTC.
Linux is a trademark of Linus Torvalds.
Powered by Linux, Apache and PHP


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers