Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

fl command - set record length

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 07-14-2006
Tom Siegel Tom Siegel is offline
Registered User
 
Join Date: Jul 2006
Last Activity: 16 August 2006, 4:06 PM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
fl command - set record length

Hi,

I have a KSH shell script running on hpux that uses the fl command - ex:
cat /foo | fl 50 > bar

This command will take each record in the file foo, make it 50 characters long and then write it to the file bar. my problem is that I am porting my scripts over to solaris which doesn't suport the 'fl' command.

Any ideas?

Thanks,

Tom
Sponsored Links
    #2  
Old Unix and Linux 07-17-2006
aigles's Unix or Linux Image
aigles aigles is offline Forum Advisor  
Registered User
 
Join Date: Apr 2004
Last Activity: 1 December 2014, 9:03 AM EST
Location: Bordeaux, France
Posts: 1,711
Thanks: 2
Thanked 62 Times in 58 Posts
On my AIX box :

Code:
newform -l50 -a -b /foo > bar

and for all Unix with awk :

Code:
awk '{printf'"%-50.50s\n",$0)}' /foo > bar

Jean-Pierre.
Sponsored Links
    #3  
Old Unix and Linux 07-17-2006
Tom Siegel Tom Siegel is offline
Registered User
 
Join Date: Jul 2006
Last Activity: 16 August 2006, 4:06 PM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks !!!!!
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Make variable length record a fixed length jclanc8 Shell Programming and Scripting 3 10-03-2009 09:24 PM
awk to find the length of each record. mac4rfree Shell Programming and Scripting 0 08-20-2009 10:22 AM
Check length of record DebianJ Shell Programming and Scripting 5 08-06-2009 04:19 PM
What the command to find out the record length of a fixed length file? tranq01 UNIX for Dummies Questions & Answers 9 12-04-2008 04:04 PM
AWK record length fix kanu_pathak Shell Programming and Scripting 4 10-08-2008 04:28 PM



All times are GMT -4. The time now is 09:55 PM.