Sponsored Content
Top Forums Shell Programming and Scripting Script to get the heading in files along with data Post 302850257 by Vivekit82 on Wednesday 4th of September 2013 11:04:34 AM
Old 09-04-2013
Script to get the heading in files along with data

Hi everyone,

I have a file which has data with different heading and column names as below.

Code:
Static Data Ingested
,,,,,,,,,,,,Known Explained Rejections
Column_1,column_2,Column_3,Column_4,,Column_6,Column_7,,% Column_8,,Column_9 ,Column_10
viv,Public_456,08/28/2013,1234566,,08/31/2013,5896325,,0.00,,0,0
SDS,Public_ddd,08/28/2013,589652,,08/31/2013,2365896,,0.00,,0,1

In the above few are null columns and Static Data Ingested is the heading of therecords at line 1.At line 2 is ,,,,,,,,,,,,Known Explained Rejections and at line 3 and 4 are the column names and the records.

After few lines say line 20 start the second heading and the records as below:

Code:
Static Data extracted
Column_1,Column_2,Column_3,Column_4,Column 5,Column_6,Column 7
rms,k2c,5896325,0.00,,0,1
SDS,k3c,2365896,0.00,,0,0

Now i want to get the data from the above records only if Column 9 and 10 in first heading(Static Data Ingested) and column column 6 and 7 in second heading(Static Data extracted) have records other than 0.

For the above input output should be as below.

Code:
 
Static Data Ingested:
Column_1,column_2,Column_3,Column_4,,Column_6,Column_7,,% Column_8,,Column_9 ,Column_10
SDS,Public_ddd,08/28/2013,589652,,08/31/2013,2365896,,0.00,,0,1

Static Data extracted:
Column_1,Column_2,Column_3,Column_4,Column 5,Column_6,Column 7
rms,k2c,5896325,0.00,,0,1

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to delete all data from multiple files

its urgent!!!!!!111 i need a script which can delete data from multiple files. plz if anybody knows the script plz write a mail to me : (Email addresses are not allowed) (5 Replies)
Discussion started by: uni_ajay_r
5 Replies

2. Shell Programming and Scripting

shell script for log files data!

Hi Team, please write a shell script. It is for veritas netbackup logs. The result we currently have is a single file for each day's backups. we will keep the files in the directory and the file names are like below mentioned. example :/opt/openv/netbackup/reports/Daily/NB_success*. The No... (6 Replies)
Discussion started by: rvrao77
6 Replies

3. Shell Programming and Scripting

Perl script for extract data from xml files

Hi All, Prepare a perl script for extracting data from xml file. The xml data look like as AC StartTime="1227858839" ID="88" ETime="1227858837" DSTFlag="false" Type="2" Duration="303" /> <AS StartTime="1227858849" SigPairs="119 40 98 15 100 32 128 18 131 23 70 39 123 20 120 27 100 17 136 12... (3 Replies)
Discussion started by: allways4u21
3 Replies

4. Shell Programming and Scripting

Help - Bug: A script to compile two types of data files into two temporary files

Dear other forum members, I'm writing a script for my homework, but I'm scratching all over my head and still can't figure out what I did wrong. Please help me. I just started to learn about bash scripting, and I appreciate if anyone of you can point out my errors. I thank you in advance. ... (3 Replies)
Discussion started by: ilove2smoke
3 Replies

5. Shell Programming and Scripting

awk script processing data from 2 files

Hi! I have 2 files containing data that I need to process at the same time, I have problems in reading a different number of lines from the different files. Here is an explanation of what I need to do (possibly with an awk script). File "samples.txt" contains data in the format: time_instant... (6 Replies)
Discussion started by: Alice236
6 Replies

6. UNIX for Dummies Questions & Answers

Extract columns from multiple files with a file name as heading

Hi All, I have 7 files, each containing 9 columns separated by space. I want to extract the 9th columns from every file and save in a new file. The columns must be pasted next to each other. And the title of each columns should be the name of the corresponding files! Since the 3rd column is... (1 Reply)
Discussion started by: Unilearn
1 Replies

7. Programming

Python script for extracting data using two files

Hello, I have two files. File 1 is a list of interested IDs Ex1 Ex2 Ex3File 2 is the original file with over 8000 columns and 20 millions rows and is a compressed file .gz Ex1 xx xx xx xx .... Ex2 xx xx xx xx .... Ex2 xx xx xx xx ....Now I need to extract the information for all the IDs of... (4 Replies)
Discussion started by: nans
4 Replies

8. Shell Programming and Scripting

SQL Column Heading

Hi, I am selecting few columns from a table using select query in UNIX shell script ans sending the results as E-mail. But the column headings are not displayed fully. Instead it displays only a part of the heading. Please help as how to display it fully. Thanks in advance for your help. (7 Replies)
Discussion started by: pvelmuru
7 Replies

9. Shell Programming and Scripting

Need heading in files

Hi All, The below code is splitting the file "data.csv" into several files based on the"client_code" column. date_yyyymmdd=$(my_date "" -e"%Y%m%d") file_format="_$date_yyyymmdd.csv awk '{print $2, $3> DIR"/clients_" $1 file_out}' FS=' *; *' OFS=";" DIR="$TEMPL" file_out="_$file_format"... (3 Replies)
Discussion started by: ROCK_PLSQL
3 Replies

10. Shell Programming and Scripting

In PErl script: need to read the data one file and generate multiple files based on the data

We have the data looks like below in a log file. I want to generat files based on the string between two hash(#) symbol like below Source: #ext1#test1.tale2 drop #ext1#test11.tale21 drop #ext1#test123.tale21 drop #ext2#test1.tale21 drop #ext2#test12.tale21 drop #ext3#test11.tale21 drop... (5 Replies)
Discussion started by: Sanjeev G
5 Replies
quot(1M)																  quot(1M)

NAME
quot - summarize file system ownership SYNOPSIS
FStype] FSspecific-options] filesystem ... FStype] DESCRIPTION
The command displays the number of 1024-byte blocks in the named filesystem that are currently owned by each user. filesystem is either the name of the directory on which the file system is mounted or the name of the device containing the file system. Options recognizes the following options: Specify the file system type on which to operate (see fstyp(1M) and fs_wrapper(5)). If this option is not included on the command line, the file system type is determined from the file by matching filesystem with an entry in that file. If there is no entry in then the file system type is determined from the file Echo the completed command line, but perform no other action. The command line is generated by incorporating the user-specified options and other information derived from This option allows the user to verify the command line. Specify any options specific to the file system. Generate a report for all mounted file systems. Report size rather than user statistics. Generates histogram statistics in 3-column format: Column 1: File size in blocks. Sizes are listed in ascending order up to 499 blocks per file. Files occupying 499 or more blocks are counted together on a single line as 499-block files (but column 3 is based on actual number of blocks occupied). Column 2: Number of files of size indicated in column 1. Column 3: Cumulative total blocks occupied by files counted in current plus all preceding lines. Use of this option overrides the and options. Display number of files and space occupied by each user. Calculate the number of blocks in the file based on file size rather than actual blocks allocated. This option does not account for sparse files (files with holes in them). Accept data from the command (see ncheck(1M)) as input. Run the pipeline: to produce a list of all files and their owners. Display three columns containing the number of blocks not accessed in the last 30, 60, and 90 days. AUTHOR
was developed by the University of California, Berkeley, Sun Microsystems, Inc., and HP. FILES
Specifies the default file system type Static information about the file systems Mounted file system table Password file (contains user names) SEE ALSO
quot_hfs(1M), quot_vxfs(1M), du(1), find(1), ls(1), fstyp(1M), mount(1M), ncheck(1M), repquota(1M), fs_wrapper(5), quota(5). quot(1M)
All times are GMT -4. The time now is 05:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy