Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Split 1 column into numerous columns based on patterns Post 302957603 by RudiC on Tuesday 13th of October 2015 06:56:46 AM
Old 10-13-2015
Quote:
Originally Posted by mmab
That works! thanks to those who responded.

---------- Post updated at 11:46 AM ---------- Previous update was at 11:25 AM ----------

One last thing. In the input file there is the possibility that there will be blank spaces for some of the data values. For instance;

Code:
 
"NEW PRODUCT, VERSION 1.1"
PRODUCT_01
"PRODUCT FIELD"
FIELD_X
3333333.0000000
  
4444444.0000000

The output looks like;

Code:
 
"NEW PRODUCT, VERSION 1.1"
PRODUCT_01
"PRODUCT FIELD"
FIELD_X
3333333.0000000
4444444.0000000

Is there a way to keep the blank spaces?
Did you run post#7's code on that data?
 

10 More Discussions You Might Find Interesting

1. Web Development

split the fields in a column into 3 columns

Have a column "address" which is combination of city, region and postal code like. Format is : city<comma><space>region<space>postal code abc, xyz 123456 All these three city, region and postal code are not mandatory. There can be any one of the above. In that case a nell... (2 Replies)
Discussion started by: rakshit
2 Replies

2. UNIX for Dummies Questions & Answers

split one column into multiple columns

hey guys... Im looking to do the following: 1 2 3 4 5 6 7 8 9 Change to: 1 4 7 2 5 8 3 6 9 Did use | perl -lpe'$\=$.%3?$":"\n"' , but it doesnt give me the matrix i want. (3 Replies)
Discussion started by: zaneded
3 Replies

3. Shell Programming and Scripting

split one column into multiple columns

hey, i have the following data: 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 (7 Replies)
Discussion started by: zaneded
7 Replies

4. Shell Programming and Scripting

Split into columns based on the parameter and use & as delimiter

Here is my source, i have million lines like this on a file. disp0201.php?poc=4060&roc=1&ps=R&ooc=13&mjv=6&mov=5&rel=5&bod=155&oxi=2&omj=5&ozn=1&dav=20&cd=&daz=& drc=&mo=&sid=&lang=EN&loc=JPN I want to split this into columns in order to load in database, anything starts with"&mjv=6" as first... (13 Replies)
Discussion started by: elamurugu
13 Replies

5. Shell Programming and Scripting

Split the file based on column

Hi, I have a file sample_1.txt (300k rows) which has data like below: * Also each record is around 64k bytes 11|1|abc|102553|125589|64k bytes of data 10|2|def|123452|123356|...... 13|2|geh|144351|121123|... 25|4|fgh|165250|118890|.. 14|1|abc|186149|116657|......... (6 Replies)
Discussion started by: sol_nov
6 Replies

6. UNIX for Dummies Questions & Answers

Split file based on column

i have file1.txt asdas|csada|130310|0423|A1|canberra sdasd|sfdsf|130426|2328|A1|sydney Expected output : on eaceh third and fourth colum, split into each two characters asdas|csada|13|03|10|04|23|A1|canberra sdasd|sfdsf|13|04|26|23|28|A1|sydney (10 Replies)
Discussion started by: radius
10 Replies

7. Shell Programming and Scripting

awk to sum a column based on duplicate strings in another column and show split totals

Hi, I have a similar input format- A_1 2 B_0 4 A_1 1 B_2 5 A_4 1 and looking to print in this output format with headers. can you suggest in awk?awk because i am doing some pattern matching from parent file to print column 1 of my input using awk already.Thanks! letter number_of_letters... (5 Replies)
Discussion started by: prashob123
5 Replies

8. UNIX for Dummies Questions & Answers

File merging based on column patterns

Hello :) I am in this situation: Input: two tab-delimited files, `File1` and `File2`. `File2` (`$2`) has to be parsed by patterns found in `File1` (`$1`). Expected output: tab-delimited file, `File3`. `File3` has to contain the same rows as `File2`, plus the corresponding value in... (5 Replies)
Discussion started by: dovah
5 Replies

9. UNIX for Beginners Questions & Answers

How to split a column based on |?

Hi all, Newbie here, so please bear over with my stupid question :) I have used far too long time today on figuring this out, so I hope that someone here can help me move on. I have some annotation data for a transcriptome where I want to split a column containing NCBI accession IDs into a... (7 Replies)
Discussion started by: BioBing
7 Replies

10. UNIX for Beginners Questions & Answers

Using awk to split a column into two columns

Hi, I am trying to split the following output into two columns, where each column has Source: Destination: OUTPUT TO FILTER $ tshark -r Capture_without_mtr.pcap -V | awk '/ (Source|Destination): /' | more Source: x.x.x.x Destination: x.x.x.x Source:... (2 Replies)
Discussion started by: sand1234
2 Replies
stl_key(5)							File Formats Manual							stl_key(5)

Name
       stl_key - setld kit manufacturing key file

Description
       The manufacturing key files are used by the software kitting program in producing software distribution packages in format.

       A  key file has a global data section and a subset descriptor section. The sections are separated by a line that is empty except for the %%
       character sequence.

       The global section contains the product level attributes of the product. Comments are permitted in this section. They begin with the number
       sign  (#)  character and end at the next newline character.  Attributes are specified by giving the attribute key, an equal sign (=), and a
       value for the attribute.  There must be no white space surrounding the equals sign (=). There are five attributes that must be present with
       non-null values. These are NAME, CODE, VERS, MI, and ROOT.  An explanation of each of the attributes follows:

	  NAME	    The name of the product. The value for NAME is a string of up to 40 characters.

	  CODE	    The 3-character product code for the product, for example, ULT.

	  VERS	    The 3-digit version code for the product, for example, 040.

	  MI	    The pathname of the master inventory file for the product.

	  ROOT	    A  flag with values of 0 or 1. It is used to determine if a ROOT image checksum should be computed for the product image file.
		    There is no ROOT image in any product other than ULTRIX. Set it to 0.

	  RXMAKE    A flag with values of 0 or 1. Setting it to 0 suppresses the manufacture of subset images for distribution on RX50	diskettes.
		    Omitting this attribute from the key file will cause the program to assume a default value of 1. Digital recommends setting it
		    to 0.

	  COMPRESS  A flag with values of 0 or 1. Setting it to 1 causes the subset images to be compressed  using  the  utility,  thereby  saving
		    space  on the distribution media. Setting it to 0 suppresses compression. Omitting this attribute from the key file will cause
		    the program to assign a default value of 0.

       The subset descriptor section contains one subset descriptor for each subset in the product. There is one subset  descriptor  per  line	in
       this section and comments are not permitted.

       A  subset  descriptor  contains subset-specific attributes in four fields separated by TAB (CTRL/I) characters. A description of each field
       follows:

	  SUBSET    This field contains the name of the subset being described by the descriptor. The subset name is composed of the product code,
		    name and version code.

	  DEPENDENCIES
		    A list of subsets on which the described subset depends. If there are no such subsets, the period character (.) is used.  Mul-
		    tiple subset dependencies are separated by a vertical bar character (|).

	  FLAGS     A subset flags value. This is an integer. Bit 0 is used to mark the subset as irremovable. If bit 0 is set, can  never  delete
		    the  subset. Bit 1 is used to mark the subset as optional, otherwise it is mandatory and must be installed from the media when
		    encountered by

	  DESCRIPTION
		    This is a description of the subset in 40 or fewer characters.  It is used in the menu that presents to a user installing  the
		    software. If spaces are desired in this field, the field must be enclosed in single quotes.

       The subset descriptors must be listed in the order in which the subsets are installed by

Restrictions
       The required attributes and default values are not optimal.

       Comments in the subset descriptor section will cause serious problems when encountered by the program.

       TAB formatting in the subset descriptors is tightly enforced by the program.

Examples
       This is an example key file:
	   #	 ULW400.k -
	   #	      ULTRIX WS V4.0 Server 2/2 (VAX) Mfg Key File
	   #
	   #	 "@(#)ULW400.k	2.2 (ULTRIX) 4/12/89"
	   #
	   #	 000  02-mar-1989    ccb
	   #	 Copy from V2.0 (VAX) Sources
	   #	 Revision update for V4.0

	   #% PRODUCT-LEVEL ATTRIBUTES
	   NAME='ULTRIX Worksystem Software V4.0'
	   CODE=UWS
	   VERS=400
	   MI=ULT400.mi
	   ROOT=0
	   RXMAKE=0
	   COMPRESS=1

	   #% SUBSET-LEVEL ATTRIBUTES
	   %%
	   UWSX11400  ULTINET400     0	  'X11/DECwindows User Environment'
	   UWSFONT400 UWSX11400 0    'X11/DECwindows 75dpi Fonts'
	   UWSFONT15400    .	2    'X11/DECwindows 100dpi Fonts'
	   UWSDECW400 .    2	'Optional DECwindows Applications'
	   UWSXDEV400 ULTPGMR400     2	  'Worksystems Development Software'
	   UWSMAN400  ULTDCMT400     2	  'UWS Manual Pages'

See Also
       kits(1), stl_comp(5), stl_ctrl(5), stl_image(5), setld(8)
       Guide to Preparing Software for Distribution on ULTRIX Systems

																	stl_key(5)
All times are GMT -4. The time now is 01:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy