Unix Commands One Should Know

Search This Blog

Thursday, January 24, 2013

Perform Action for Every Line in a File

The following scripts shows a method for performing an action for each line in a file.
#!/bin/bash
while read LINE; do
  # Do something with the line.
  echo $LINE;
done < /tmp/myfile.txt
Posted by heavenz.com at 8:23 PM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ▼  2013 (32)
    • ▼  January (32)
      • Copy File Path And Name Using Windows Explorer Con...
      • Create a text file of the contents of a directory ...
      • Dir Command - Displays a list of files and subdire...
      • Batch files to list all files and directories in a...
      • System/tcsh Commands
      • Time Commands
      • I/O redirection and pipes
      • File Maintenance
      • Displaying/Searching file contents
      • Default Terminal Keys
      • CRON : Scheduling Tasks on Linux
      • CRON
      • Automating Database Startup and Shutdown on Linux
      • Hide Passwords
      • Linux Process Management (ps, top, renice, kill)
      • CPU Usage
      • General Performance
      • Linux Archive Tools (tar, star, gzip, bzip2, zip, ...
      • Compress Files
      • Run Commands As Oracle User From Root
      • Remove DOS CR/LFs (^M)
      • alias
      • Perform Action for Every Line in a File
      • Perform Action for Every File in a Directory
      • Rotate Log Files
      • File Exists Check
      • Remove Old Files
      • Error Lines in Files
      • uname and hostname
      • Process Management
      • File Permissions
      • Basic File Navigation

Total Pageviews

4869
Simple theme. Powered by Blogger.