Display Line numbers | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Display Line numbers

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-05-2009
ma466 ma466 is offline
Registered User
 
Join Date: Dec 2007
Last Activity: 3 June 2009, 2:51 PM EDT
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Display Line numbers

Hi all experts,

I am getting error in my shell scripts and i want to find out which lines is in errors. How i can display the line numbers . Is it NU command? Please give me some suggestions.

Last edited by joeyg; 01-05-2009 at 11:28 AM.. Reason: Corrected spelling
Sponsored Links
    #2  
Old 01-05-2009
Ikon's Avatar
Ikon Ikon is offline Forum Advisor  
Computer Geek
 
Join Date: Jul 2008
Last Activity: 10 July 2013, 11:06 AM EDT
Location: Frederick, MD
Posts: 748
Thanks: 4
Thanked 10 Times in 9 Posts

Code:
sed = filename | sed 'N;s/\n/\t/'

or

sed = filename | sed 'N; s/^/     /; s/ *\(.\{6,\}\)\n/\1  /'


Last edited by Ikon; 01-05-2009 at 10:22 AM..
Sponsored Links
    #3  
Old 01-05-2009
ma466 ma466 is offline
Registered User
 
Join Date: Dec 2007
Last Activity: 3 June 2009, 2:51 PM EDT
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks.
    #4  
Old 01-06-2009
summer_cherry summer_cherry is offline Forum Advisor  
Registered User
 
Join Date: Jun 2007
Last Activity: 23 July 2014, 3:17 AM EDT
Location: Beijing China
Posts: 1,294
Thanks: 0
Thanked 24 Times in 24 Posts

Code:
cat -n filename

Sponsored Links
    #5  
Old 01-06-2009
the wonderer the wonderer is offline
Registered User
 
Join Date: Jan 2009
Last Activity: 22 June 2009, 2:48 AM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
I am not sure which shell you are using, I am assuming it is bash shell.

You can try the following to debug your script:


Code:
bash -v myscript

or :


Code:
bash -x myscript

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Display mutiple line in single line manosubsulo Shell Programming and Scripting 4 11-11-2008 10:44 PM
I would like to separate a line and display accordingly.. suri.tyson Shell Programming and Scripting 6 09-25-2008 07:13 AM
display lines after a particular line number rajashekar.y UNIX for Dummies Questions & Answers 6 01-03-2007 02:53 AM
Display a particular line from a file Rohini Vijay Shell Programming and Scripting 5 07-31-2006 07:27 AM
Display Printers via command line gseyforth Windows & DOS: Issues & Discussions 3 06-28-2006 01:02 AM



All times are GMT -4. The time now is 11:11 AM.