Sponsored Content
Top Forums Shell Programming and Scripting use of format file to extract columns from a source file Post 302268266 by ivhb on Monday 15th of December 2008 09:43:00 AM
Old 12-15-2008
Code:
awk -F "(,|[ \t]+)" '
NR == FNR {
  if (cnt[$1] ++ == 0)
     col[j++] = $1
}
NR != FNR {
  for (i = 0; i < j; i ++)
     printf ("%s%s", i ? " " : "", $(col[i]))
  printf ("\n")
}' your-format-file  your-data-file

output:
d f g
5 9 7
1 4 5
1 4 5

is this what you want?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract and format information from a file

Hi, Following is sample portion of the file; <JDBCConnectionPool DriverName="oracle.jdbc.OracleDriver" MaxCapacity="10" Name="MyApp_DevPool" PasswordEncrypted="{3DES}7tXFH69Xg1c=" Properties="user=MYAPP_ADMIN" ShrinkingEnabled="false" ... (12 Replies)
Discussion started by: sujoy101
12 Replies

2. Shell Programming and Scripting

Help, need to extract columns from file

I have huge fixed width, text file in unix box and I need to extract columns found between the width 105 and 200 and output it to a new file. Can anyone tell me how to extract it? Thanks for your help. (1 Reply)
Discussion started by: kiran2k
1 Replies

3. UNIX for Advanced & Expert Users

How to extract a particular file in tar.Z format

Hi , I need to extarct only a particulay files from the tar.Z. ie i need to extract one.txt from test.tar.Z. The test.tar.Z may contain lot of file and folders. Please help me to extract particular file to some location. Regards, Kalai. (1 Reply)
Discussion started by: kalpeer
1 Replies

4. Shell Programming and Scripting

Extract Columns from file

Hi All, Could you please help me with following: I have to parse a .csv file. For example: If the csv file contains 3 columns, then i have to print the column names. The field separator is (comma). example.csv (contains 2 lines as follows) This is,a test file, for validation... (2 Replies)
Discussion started by: vfrg
2 Replies

5. Shell Programming and Scripting

fileutility to extract columns from source file

Hi experts,Please help me for the below requirement.i have a source file.(lets say contains 50 columns). I am extarcting five columns from the source file by using pattern file.for exampleinput file:--------a,b,c,d,"a,g","v b",s,koutputfile=======a,"a,g","v b",s,kThanks in advancesubhendu (1 Reply)
Discussion started by: subhendu81
1 Replies

6. Shell Programming and Scripting

extracting columns using pattern file from source file

Hi experts,Please help me for the below requirement. i have a source file.(lets say contains 50 columns). I am extarcting five columns from the source file by using pattern file. for example input file:--------a,b,c,d,"a,g","v b",s,koutputfile=======a,"a,g","v b",s,kThanks in advance subhendu (2 Replies)
Discussion started by: subhendu81
2 Replies

7. Shell Programming and Scripting

How to Split a source file in specified format?

Requirement: Need to split a source file say a1.txt which can be of size upto 150 MB into 25 target files each with a max size of 25 MB along with the header line in each target file. NOTE: Few target files can be empty also ,but 25 files must be generated for 1 source file( I can expect upto... (4 Replies)
Discussion started by: mad_man12
4 Replies

8. Shell Programming and Scripting

Extract the correct format of file Name

All, Objective : Extract the correct format of a file name. Please share the script command which will extract the correct format of the file after untarring. Example : If the file is of .csv format then extract filename.csv if the file is having .CSV then extract the same.CSV if the file... (1 Reply)
Discussion started by: Mahesh G
1 Replies

9. Shell Programming and Scripting

Extract columns into seperate file

I have a comma delimited file as per the one below and I am currently extracting the values in 2 columns (COL1 & COL6) to produce a smaller trimmed down version of the file which only contains the columns we need; COL1,COL2,COL3,COL4,COL5,COL6,COL7,COL8,COL9... (1 Reply)
Discussion started by: Ads89
1 Replies

10. Shell Programming and Scripting

Match Columns in one file and extract columns from another file

Kindly help merging information from two files with the following data structure. I want to match for the CHR-SNP in Foo and get the columns that match from CHROM-rsID Fields 1 & 2 of foo may have duplicates, however, a joint key of Fields $1$2$3$4 is unique. Also would be helpful to clean up... (4 Replies)
Discussion started by: genehunter
4 Replies
ICNS2PNG(1)							   User Commands						       ICNS2PNG(1)

NAME
icns2png - convert Mac OS icns files to png images SYNOPSIS
icns2png [-x|-l] [options] [file ... ] DESCRIPTION
icns2png extracts images from mac .icns files, and exports them to png format. OPTIONS
-l, --list List the contents of one or more icns images -x, --extract Extract one or more icons to png images -o, --output Where to place extracted files. If not specified, icons will be extracted to the same path as the source file. -d, --depth Sets the pixel depth of the icons to extract. (1,4,8,32) -s, --size Sets the width and height of the icons to extract. (16,48,etc) Sizes 16x12, 16x16, 32x32, 48x48, 128x128, etc. are also valid. -h, --help Displays this help message. -v, --version Displays the version information EXAMPLES
icns2png -x anicon.icns # Extract all icon found in anicon.icns icns2png -x -s 48 anicon.icns # Extract all 48x48 32-bit icons icns2png -x -s 32 -d 1 anicon.icns # Extract all 32x32 1-bit icons icns2png -l anicon.icns # Lists the icons contained in anicon.icns AUTHOR
Written by Mathew Eis COPYRIGHT
Copyright (C) 2001-2008 Mathew Eis This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. icns2png 1.5 March 2008 ICNS2PNG(1)
All times are GMT -4. The time now is 03:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy