The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
bash. convert mpeg adts to normal mp3 stahoo23 Shell Programming and Scripting 5 05-18-2008 02:26 AM
what are some different commands in c shell and korn shell?? EquinoX UNIX for Dummies Questions & Answers 1 01-28-2008 09:14 PM
bourne shell or korn shell? XZOR UNIX for Dummies Questions & Answers 2 10-05-2006 11:34 PM
How to Convert scientific notation to normal ? maheshsri Shell Programming and Scripting 2 01-05-2006 10:33 AM
KORN Shell - Spawn new shell with commands frustrated1 Shell Programming and Scripting 2 04-20-2005 11:23 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 11-22-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
Quote:
Originally Posted by forevercalz
ok..my output was something similar to this..
abc

abc

abc

and when i run this ...i will get
abc abc abc...

i can get this in korn shell ..but not in bourne..dun know why,,
what was your input [$1 file content] to this script?
Reply With Quote
Forum Sponsor
  #9  
Old 11-22-2005
Registered User
 

Join Date: Sep 2005
Posts: 74
it is a txt file. abc.txt
the text file contains this:
abc

abc

abc
Reply With Quote
  #10  
Old 11-22-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
Quote:
Originally Posted by forevercalz
it is a txt file. abc.txt
ok....... what's the content of abc.txt?

if abc.txt contains the following:
Code:
abc
def
123
456
789
and runnning the script under '/bin/ksh' I get the following output in abc.txt:
Code:
456 789
which is exactly what the script is supposed to do.
Reply With Quote
  #11  
Old 11-22-2005
Registered User
 

Join Date: Sep 2005
Posts: 74
Smile

yes..you are right...but now i do not want it to be done in korn shell..i want it in bourne shell....when i run it in bourne shell..it doesnt works..which i hope you guys can help me out...
Reply With Quote
  #12  
Old 11-22-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
a shell independent script:
Code:
#!/bin/sh
home=c:/..../
input=$1

nawk 'FNR > 3 {printf("%s%c", $0, OFS)}END{print ""}' "$1"  > "$1".out && mv "$1".out "$1"
Reply With Quote
  #13  
Old 11-22-2005
Registered User
 

Join Date: Sep 2005
Posts: 74
hi thanks however..why i get my output like this? in sliding manner.. i only want a space after each abc...
abc
...................abc
............................................... abc

please ingore the dots...
Reply With Quote
  #14  
Old 11-22-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
Quote:
Originally Posted by forevercalz
hi thanks however..why i get my output like this? in sliding manner.. i only want a space after each abc...
abc
...................abc
............................................... abc

please ingore the dots...
strange.......

given input [ $1 ]:
Code:
1
2
3
4
123
123456
and the script above ..... I get:
Code:
4 123 123456
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0