LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-10-2008, 12:32 AM   #1
jkeertir
Member
 
Registered: Mar 2008
Posts: 70

Rep: Reputation: 15
shell scripting


Dear all,

Can anyone help me to write shell script for reading content of the file line by line,and displaying that content in a specific format.

With Regards,
Keerti jain
 
Old 04-10-2008, 12:45 AM   #2
kkpal
Member
 
Registered: Oct 2007
Posts: 101

Rep: Reputation: 15
Quote:
Originally Posted by jkeertir View Post
Dear all,

Can anyone help me to write shell script for reading content of the file line by line,and displaying that content in a specific format.

With Regards,
Keerti jain

hi Keerti

Which type of specific format do you want? can you give me some more detail about your problem?


Regards
KKPal
 
Old 04-10-2008, 01:13 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
To read the first 5 lines into 5 different variables:

Code:
for i in `seq 1 5`; do read var$i ;  done < filename
This gives one example of how "read" works. As for formatting, read up on printf.

The best guides are at http://tldp.org

Look for Bash Guide for Beginners and the Advanced Bash Scripting Guide
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Terminal functions for shell scripting with Shell Curses LXer Syndicated Linux News 0 03-27-2008 12:50 AM
SHELL scripting/ shell functions mayaabboud Linux - Newbie 6 12-26-2007 09:18 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 03:14 AM
teaching shell scripting: cool scripting examples? fax8 Linux - General 1 04-20-2006 05:29 AM
shell interface vs shell scripting? I'm confused jcchenz Linux - Software 1 10-26-2005 04:32 PM


All times are GMT -5. The time now is 10:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration