03-31-2009
Thank you for that but what if the 4th column are strings with spaces in between? Is there a way to dictate awk to start looking at a certain point like looking at every 200th character of each line?
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am using the following command at the Unix prompt to make my 'infile' into a fixed width file of 100 characters.
awk '{printf "%-100s\n",$0}' infile > outfile
However, there are some records with a special character "©"
These records are using 3 characters in place of one and my record... (2 Replies)
Discussion started by: alok.benjwal
2 Replies
2. Shell Programming and Scripting
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
3. Shell Programming and Scripting
Hi, Iam new to unix. I have one input file .
Input file :
ID1~Name1~Place1
ID2~Name2~Place2
ID3~Name3~Place3
I need output such that only first column should change to fixed width column of 15 characters of length.
Output File:
ID1<<12 spaces>>Name1~Place1
ID2<<12... (5 Replies)
Discussion started by: manneni prakash
5 Replies
4. Shell Programming and Scripting
I was wondering someone might be able to push me in the right direction, I am writing a script to modify fixed-width spool files, As you can see below the original spool file broke a single line into two for printability sake.
I have had been able do the joins using sed, the thing I am... (10 Replies)
Discussion started by: Cho Nagurai
10 Replies
5. Shell Programming and Scripting
Source File:
abcdefghijklmnop01qrstuvwxyz
abcdefghijklmnop02qrstuvwxyz
abcdefghijklmnop03qrstuvwxyz
abcdefghijklmnop04qrstuvwxyz
abcdefghijklmnop05qrstuvwxyz
Whatever characters are in 17-18 on each line of the file, it should be concatenated to the same line at the character number... (6 Replies)
Discussion started by: tamahomekarasu
6 Replies
6. UNIX for Dummies Questions & Answers
Hi,
How to output the duplicate record to another file. We say the record is duplicate based on a column whose position is from 2 and its length is 11 characters.
The file is a fixed width file.
ex of Record:
DTYU12333567opert tjhi kkklTRG9012
The data in bold is the key on which... (1 Reply)
Discussion started by: Qwerty123
1 Replies
7. Shell Programming and Scripting
Hi,
I have a fixed width text file without any header row. One of the columns contains a date in YYYYMMDD format.
If the original file contains 3 dates, I want my shell script to split the file into 3 small files with data for each date.
I am a newbie and need help doing this. (14 Replies)
Discussion started by: bhanja_trinanja
14 Replies
8. Shell Programming and Scripting
I have a fixed with file with header & trailer length having the same length of the detail record file.
The details record length of this file is 24, for Header and Trailer the records will be padded with spaces to match the record length of the file
Currently I am adding 3 spaces in header... (14 Replies)
Discussion started by: ginrkf
14 Replies
9. Shell Programming and Scripting
hi,
i have a fixed width file with multiple columns and need to print data using awk command.
i use: awk -F "|" '($5 == BH) {print $1,$2,$3}' <non_AIM target>.txt for a delimiter file.
but now i have a fixed width file like below:
7518 8269511BH 20141224951050N8262
11148 8269511BH... (5 Replies)
Discussion started by: kcdg859
5 Replies
LEARN ABOUT HPUX
unexpand
expand(1) General Commands Manual expand(1)
NAME
expand, unexpand - expand tabs to spaces, and vice versa
SYNOPSIS
tablist] [file ...]
tablist] [file ...]
Obsolescent:
tabstop] tabn] [file ...]
DESCRIPTION
processes the named files or the standard input and writes to the standard output with tabs changed into spaces. Backspace characters are
preserved in the output, and the column count is decreased by one column for tab calculations. For proper tab calculation, if a multi-col-
umn character is to be "backspace'd", it should be followed by multiple backspace characters which equal to it's column width. If a tab
character is found after the last tab position, it is replaced by a single space. is useful for preprocessing character files that contain
tabs (before sorting, looking at specific columns, etc).
recognizes the following command-line options and arguments:
tablist specifies where to set the tab positions instead of the default tablist can take two forms. If it is a single num-
ber, tabs are set tablist spaces apart. tablist can also be a blank- or comma-separated list of increasing positions
where tabs are to be set.
This option is obsolescent and is equivalent to using
This option is obsolescent and is equivalent to using
processes the named files or the standard input and writes to the standard output with spaces changed into tabs where possible. By
default, only leading spaces and tabs are converted to maximal strings of tabs. The default tab position is every 8 characters. Backspace
characters are preserved into the output, and the column count is decreased by one column for tab calculations. For proper tab calcula-
tion, if a multi-column character is to be "backspace'd", it should be followed by multiple backspace characters which equal to it's column
width.
recognizes the following command-line options and arguments:
Tabs are inserted whenever they would compress the resultant file
by replacing two or more spaces before a tab position.
tablist specifies the tab positions. tablist can take two forms. If it is a single number, tabs are set every tablist spa-
ces apart. If tablist is a blank- or comma-separated list of increasing positions, tabs are set at those locations.
The option implies the option. If the option is not specified, the default is equivalent to specifying except that
is not implied for this case.
EXTERNAL INFLUENCES
Environment Variables
determines the interpretation of text as single and/or multi-byte characters.
determines the language in which messages are displayed.
If or is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty
variable. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of
If any internationalization variable contains an invalid setting, and behave as if all internationalization variables are set to "C". See
environ(5).
If is set to a non-empty string value, it overrides the values of all the other internationalization variables.
International Code Set Support
Single- and multi-byte character code sets are supported with the exception that do not recognize multi-byte alternative space characters.
STANDARDS CONFORMANCE
expand(1)