Thanks Bipin .. Though My Requirement is quite big.
I mean.. Suppose I have 1500 character data length for say 100 columns file and having length for all columns (as defined earlier example - not fixed) out of which -
say 1200 character are fixed length for say 70 columns and remaining 30 columns are having variable length. Now as mentioned in previous example -
Maximum length of all columns will be 1500
and least will be 1200.
Now I have to separate all these 100 columns with a delimiter and require some automation (Cause I have a situation where I need to separate 900 columns), as defining substring every time doesn't seems feasible.
Thanks in Advance!!
Last edited by Scrutinizer; 01-28-2013 at 01:29 PM..
Reason: code tags
Hi Everybody,
I need some help on formatting the files coming into unix box on the fly.
I get a file some thing like this in a single line.
ISA^M00^M ^M00^M ^M14^M006929681900 ^M01^M095449419 ... (5 Replies)
Hi experts.
I got a file (500mb max) and need to pivot it (loading into ORCL) and change BLANK delimiter to PIPE |.
Sometimes there are multipel BLANKS (as a particular value may be BLANK, or simply two BLANKS instead of one BLANK).
thanks for your input!
Cheers,
Layout... (3 Replies)
Hi All,
I am new to unix scripting, please help me in solving this assignment..
I have a scenario, as follows:
1. i have a text file(read1.txt) with the following data
sairam,123
kamal,122
etc..
2. I have to write a unix... (6 Replies)
Im writing a KSH script to read a simple text file and add a delimiter. Ive written the following script but it runs very slow. I initially used the cut command to substring the input record then switched to this version using awk to substring... both run too slow. Any ideas how to make this more... (2 Replies)
Hi,
I have a string like ABC.123.XYZ-A1-B2-P1-C4. I want to delimit the string based on "-" and then get result as only two strings. One with string till last hyphen and other with value after last hyphen... For this case, it would be something like first string as "ABC.123.XYZ-A1-B2-P1" and... (6 Replies)
Hi,
I'm new to unix, i have a variable length file like below,
01|Test|Test1|Sample|
02|AA|BB|CC|DD|
03|AAA|BBB|CCC|DDD|EEE|RRR|TTT|SSS|YYY|
I need to make this as a fixed length file. Assume that i have 10 columns in the DAT file.
for ex: the first 01 record is having 4cols -... (8 Replies)
A text file has 2 fields (Data, Filename) delimited by # as below,
Data,Filename
Row1 -> abc#Test1.xml
Row2 -> xyz#Test2.xml
Row3 -> ghi#Test3.xml
The content in first field has to be written into a file where filename should be considered from second field.
So from... (4 Replies)
Hi,
Extremely new to Perl scripting, but need a quick fix without using TEXT::CSV
I need to read in a file, pass any delimiter as an argument, and convert it to bar delimited on the output. In addition, enclose fields within double quotes in case of any embedded delimiters.
Any help would... (2 Replies)
Hi, all.
I have an input file. I would like to generate 3 types of output files.
Input:
LG10_PM_map_19_LEnd_1000560
LG10_PM_map_6-1_27101856
LG10_PM_map_71_REnd_20597718
LG12_PM_map_5_chr_118419232
LG13_PM_map_121_24341052
LG14_PM_1a_456799
LG1_MM_scf_5a_opt_abc_9029993
... (5 Replies)
I have a large semicolon delimited file with thousands of columns and many thousands of line. It looks like:
ID1;ID2;ID3;ID4;A_1;B_1;C_1;A_2;B_2;C_2;A_3;B_3;C_3
AA;ax;ay;az;01;02;03;04;05;06;07;08;09
BB;bx;by;bz;03;05;33;44;15;26;27;08;09
I want to split this table in to multiple files:
... (1 Reply)
Discussion started by: trymega
1 Replies
LEARN ABOUT HPUX
cut
cut(1) General Commands Manual cut(1)NAME
cut - cut out (extract) selected fields of each line of a file
SYNOPSIS
list [file]...
list [file]...
list char] [file]...
DESCRIPTION
cuts out (extracts) columns from a table or fields from each line in a file; in data base parlance, it implements the projection of a rela-
tion. Fields as specified by list can be fixed length (defined in terms of character or byte position in a line when using the or option),
or the length can vary from line to line and be marked with a field delimiter character such as the tab character (when using the option).
can be used as a filter; if no files are given, the standard input is used.
When processing single-byte character sets, the and options are equivalent and produce identical results. When processing multi-byte char-
acter sets, when the and options are used together, their combined behavior is very similar, but not identical to the option.
Options
Options are interpreted as follows:
list A comma-separated list of integer byte option), character option), or field option) numbers, in increasing order,
with optional to indicate ranges. For example:
Positions 1, 4, and 7.
Positions 1 through 3 and 8.
Positions 1 through 5 and 10.
Position 3 through last position.
Cut based on a list of bytes.
Each selected byte is output unless the option is also specified.
Cut based on character positions specified by
list extracts the first 72 characters of each line).
Where list is a list of fields assumed to be separated in the file by a delimiter character (see for example, copies the
first and seventh field only. Lines with no field delimiters will be passed through intact (useful for table sub-
headings), unless is specified.
The character following
is the field delimiter option only). Default is tab. Space or other characters with special meaning to the shell
must be quoted. Adjacent field delimiters delimit null fields. char may be an international code set character.
Do not split characters.
If the high end of a range within a list is not the last byte of a character, that character is not included in the
output. However, if the low end of a range within a list is not the first byte of a character, the entire character
is included in the output."
Suppresses lines with no delimiter characters when using
option. Unless is specified, lines with no delimiters appear in the output without alteration.
Hints
Use to extract text from a file based on text pattern recognition (using regular expressions). Use to merge files line-by-line in columnar
format. To rearrange columns in a table in a different sequence, use and See grep(1) and paste(1) for more information.
EXTERNAL INFLUENCES
Environment Variables
determines the interpretation of text as single and/or multi-byte characters.
If 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 vari-
able. 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, behaves as if all internationalization variables are set to "C". See environ(5).
International Code Set Support
supports both single- and multi-byte character code sets. International code set characters may be specified in the char given to the
option. recognizes the international code set characters according to the locale specified in the environment variable.
EXAMPLES
Password file mapping of user ID to user names:
Set environment variable to current login name:
Convert file containing lines of arbitrary length into two files where contains the first 500 bytes (unless the 500th byte is within a
multi-byte character), and contains the remainder of each line:
DIAGNOSTICS
Line length must not exceed
characters or fields, including the new-line character (see limits(5).
Missing or option or incorrectly specified list. No error occurs if a line has fewer fields than the list calls for.
list is empty.
WARNINGS
does not expand tabs. Pipe text through expand(1) if tab expansion is required.
Backspace characters are treated the same as any other character. To eliminate backspace characters before processing by use the or com-
mand (see fold(1) and col(1)).
AUTHOR
was developed by OSF and HP.
SEE ALSO grep(1), paste(1).
STANDARDS CONFORMANCE cut(1)