Sponsored Content
Top Forums Shell Programming and Scripting changing a variable length text to a fixed length Post 302442058 by dc18 on Tuesday 3rd of August 2010 07:34:05 AM
Old 08-03-2010
Hi Scott,

I'm afraid your solution only works if there there are no spaces within the text ......... each space found within the text is also padded out to 18 spaces

Dave
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

creating a fixed length output from a variable length input

Is there a command that sets a variable length? I have a input of a variable length field but my output for that field needs to be set to 32 char. Is there such a command? I am on a sun box running ksh Thanks (2 Replies)
Discussion started by: r1500
2 Replies

2. Shell Programming and Scripting

convert XML file into Text file(fixed length)

If someone out there could help me out with this problem. I would really appreciate it. I am trying to convert xml into text file(fixed length) using Unix Borne shell scripts. My xml file: <root> <header_rec recordtype="00"> <record_id>00</record_id> ... (0 Replies)
Discussion started by: ram2s2001
0 Replies

3. Shell Programming and Scripting

Combining Two fixed width columns to a variable length file

Hi, I have two files. File1: File1 contains two fixed width columns ID of 15 characters length and Name is of 100 characters length. ID Name 1-43<<11 spaces>>Swapna<<94 spaces>> 1-234<<10 spaces>>Mani<<96 spaces>> 1-3456<<9 spaces>>Kapil<<95 spaces>> File2: ... (4 Replies)
Discussion started by: manneni prakash
4 Replies

4. Shell Programming and Scripting

Comparing column of variable length anf fixed width file

Hi, I have two input files. File1: ID Name Place 1-234~name1~Newyork 1-34~name2~Boston 1-2345~name3~Hungary File1 is a variable length file where each column is seperated by delimitter "~". File2: ID Country 1-34<<11 SPACES>>USA<<7 spaces>> 1-234<<10 SPACES>>UK<<8... (5 Replies)
Discussion started by: manneni prakash
5 Replies

5. UNIX for Dummies Questions & Answers

What the command to find out the record length of a fixed length file?

I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies

6. UNIX for Dummies Questions & Answers

Convert a tab delimited/variable length file to fixed length file

Hi, all. I need to convert a file tab delimited/variable length file in AIX to a fixed lenght file delimited by spaces. This is the input file: 10200002<tab>US$ COM<tab>16/12/2008<tab>2,3775<tab>2,3783 19300978<tab>EURO<tab>16/12/2008<tab>3,28523<tab>3,28657 And this is the expected... (2 Replies)
Discussion started by: Everton_Silveir
2 Replies

7. Shell Programming and Scripting

Make variable length record a fixed length

Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types: (H)eader Records (D)etail Records (T)railer Records The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies

8. Shell Programming and Scripting

fixed length text file padding issues in AIX

Hi, I have a fixed length text file that needs to be cut into individual files in aix and facing padding issues. If I have multiple blank spaces in the file it is just making it one while cutting the files.. Eg:- $ - blank space filename:file.txt ... (2 Replies)
Discussion started by: techmoris
2 Replies

9. Shell Programming and Scripting

Extracting fixed length number from a text file

Hi, I have a text file with sample records as CASE ID: 20170218881083 Original presentment record for ARN not found for Re-presentment I want to extract the 23 digit number from this file. I thought of using grep but initially couldn't extract the required number. However, after... (16 Replies)
Discussion started by: dsid
16 Replies

10. Shell Programming and Scripting

Convert variable length record to fixed length

Hi Team, I have an issue to split the file which is having special chracter(German Char) using awk command. I have a different length records in a file. I am separating the files based on the length using awk command. The command is working fine if the record is not having any... (7 Replies)
Discussion started by: Anthuvan
7 Replies
pbmtext(1)						      General Commands Manual							pbmtext(1)

NAME
pbmtext - render text into a bitmap SYNOPSIS
pbmtext [-font fontfile] [-builtin fontname] [-space pixels] [-lspace pixels] [text] DESCRIPTION
Takes the specified text, either a single line from the command line or multiple lines from standard input, and renders it into a bitmap. In the bitmap, each line of input is a line of output. Formatting characters such as newline have no effect on the formatting; like any unprintable character, they turn into spaces. The bitmap is just wide enough for the longest line of text, plus margins, and just high enough to contain the lines of text, plus margins. The left and right margins are twice the width of the widest character in the font; the top and bottom margins are the height of the tallest character in the font. But if the text is only one line, all the margins are half of this. OPTIONS
-font,-builtin By default, pbmtext uses a built-in font called bdf (about a 10 point Times-Roman font). You can use a fixed width font by specify- ing -builtin fixed. You can also specify your own font with the -font flag. The fontfile is either a BDF file from the X window system or a PBM file. If the fontfile is a PBM file, it is created in a very specific way. In your window system of choice, display the following text in the desired (fixed-width) font: M ",/^_[`jpqy| M / !"#$%&'()*+ / < ,-./01234567 < > 89:;<=>?@ABC > @ DEFGHIJKLMNO @ _ PQRSTUVWXYZ[ _ { ]^_`abcdefg { } hijklmnopqrs } ~ tuvwxyz{|}~ ~ M ",/^_[`jpqy| M Do a screen grab or window dump of that text, using for instance xwd, xgrabsc, or screendump. Convert the result into a pbm file. If necessary, use pnmcut to remove everything except the text. Finally, run it through pnmcrop to make sure the edges are right up against the text. pbmtext can figure out the sizes and spacings from that. -space pixels Add pixels pixels of space between characters. This is in addition to whatever space surrounding characters is built into the font, which is usually enough to produce a reasonable string of text. pixels may be negative to crowd text together, but the author has not put much thought or testing into how this works in every pos- sible case, so it might cause disastrous results. -B -lspace pixels Add pixels pixels of space between lines. This is in addition to whatever space above and below characters is built into the font, which is usually enough to produce a reasonable line spacing. pixels must be a whole number. pixels may be negative to crowd lines together, but the author has not put much thought or testing into how this works in every pos- sible case, so it might cause disastrous results. USAGE
Often, you want to place text over another image. One way to do this is with ppmlabel. ppmlabel does not give you the font options that pbmtext does, though. Another way is to use pbmtext to create an image containing the text, then use pnmcomp to overlay the text image onto your base image. To make only the text (and not the entire rectangle containing it) cover the base image, you will need to give pnmcomp a mask, via its -alpha option. You can just use the text image itself as the mask, as long as you also specify the -invert option to pnmcomp. If you want to overlay colored text instead of black, just use ppmchange to change all black pixels to the color of your choice before overlaying the text image. But still use the original black and white image for the alpha mask. If you want the text at an angle, use pnmrotate on the text image (and alpha mask) before overlaying. SEE ALSO
pnmcut(1), pnmcrop(1), pnmcomp(1), ppmchange(1), pnmrotate(1), pbmtextps(1), ppmlabel(1), pbm(5) AUTHOR
Copyright (C) 1993 by Jef Poskanzer and George Phillips 28 January 2001 pbmtext(1)
All times are GMT -4. The time now is 12:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy