Sponsored Content
Top Forums Shell Programming and Scripting Copy header values into records Post 302854597 by RudiC on Tuesday 17th of September 2013 04:48:02 PM
Old 09-17-2013
Two minor corrections to Corona688's proposal:
Code:
awk -F"," 'NF==1        { D=$0 ; print ; next }
           $1 == "Name" { print ; next }
                        { $0=D","$0 ; print }
        ' file

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to extract duplicate records with associated header record

All, I have a task to search through several hundred files and extract duplicate detail records and keep them grouped with their header record. If no duplicate detail record exists, don't pull the header. For example, an input file could look like this: input.txt HA D1 D2 D2 D3 D4 D4... (17 Replies)
Discussion started by: run_eim
17 Replies

2. Shell Programming and Scripting

Count No of Records in File without counting Header and Trailer Records

I have a flat file and need to count no of records in the file less the header and the trailer record. I would appreciate any and all asistance Thanks Hadi Lalani (2 Replies)
Discussion started by: guiguy
2 Replies

3. Shell Programming and Scripting

Merge text files while combining the multiple header/trailer records into one each.

Situation: Our system currently executes a job (COBOL Program) that generates an interface file to be sent to one of our vendors. Because this system processes information for over 100,000 employees/retirees (and growing), we'd like to multi-thread the job into processing-groups in order to... (4 Replies)
Discussion started by: oordonez
4 Replies

4. Shell Programming and Scripting

improve performance - replace $\| with $#@ and remove header and trailer records

Hi All, In my file i need to remove header and trailer records which comes in 1st line and last line respectively. After that i need to replace '$\|' with '$#@'. I am using sed command for this and its taking lot of time. Is there any other command which can be used to improve performance? ... (1 Reply)
Discussion started by: HemaV
1 Replies

5. UNIX for Dummies Questions & Answers

pull date from header and append to all records

I did some searches, but couldn't really find what I'm looking for. I have a file formatted as below: BOF ABC CO - XYZ COMM DATA OF 07/05/2011 EBA00000001 sdfa rtyus uyml EBB00000001 54682 984w3 EBA00000002 mkiyuasdf 98234 I want to pull the date from the header record and add it... (4 Replies)
Discussion started by: keeferb
4 Replies

6. Shell Programming and Scripting

Adding Header and Trailer records to a appended file

How can we a shell script and pass date parameters .I have 3 files comming from Datastage with |" delimited I need append 3 files as above: File1: P0000|"47416954|"AU|"000|"INS|"0000|"|"20060601|"99991231|"|"|"|"|"01 File 2:... (2 Replies)
Discussion started by: e1994264
2 Replies

7. Shell Programming and Scripting

Specific Header after every 30 records

Hi All, I have got a requirement. I have a source file, EMPFULL.txt and I need to split the data for every 30 records and place a Typical Header as below with system and page number too. 2012.01.03 Employee Dept Report 1... (6 Replies)
Discussion started by: srk409
6 Replies

8. UNIX for Dummies Questions & Answers

Dynamically merging 2 files on header values

Hi All, I have 2 files which i need to merge together based on the column names provided in the file. The first line in both files are header records. The first file has fixed columns but second file can have subset of the columns from file 1 File 1: ... (6 Replies)
Discussion started by: kushagra
6 Replies

9. Shell Programming and Scripting

Prefix a variable in the first column of all the records of the files with and without header

In a bash shell, I have to prefix a variable to two .CSV files File1.CSV and File2.CSV. One of the files has a header and the other one is with no header in the below format: "value11","value12","value13","value14","value15","value16" "value21","value22","value23","value24","value25","value26"... (7 Replies)
Discussion started by: dhruuv369
7 Replies

10. UNIX for Beginners Questions & Answers

Help in printing records where there is a 'header' in the first record ???

Hi, I have a backup report that unfortunately has some kind of hanging indent thing where the first line contains one column more than the others I managed to get the output that I wanted using awk, but just wanting to know if there is short way of doing it using the same awk Below is what... (2 Replies)
Discussion started by: newbie_01
2 Replies
TPROF(8)						    BSD System Manager's Manual 						  TPROF(8)

NAME
tprof -- record tprof profiling samples SYNOPSIS
tprof [-c] [-o file] command ... DESCRIPTION
The tprof is a sampling based profiler. tprof utility makes the kernel driver start profiling, executes the specified command, keeps recording samples from the kernel driver until the command finishes, and reports statistics to the standard error. The tprof pseudo driver and a suitable backend should be loaded beforehand. The tprof utility accepts the following options. -o file Write the collected samples to the file named file. The default is ``tprof.out''. -c Write the collected samples to the standard output. Note that the output is a binary stream. EXAMPLES
The following command profiles the system during 1 second and shows the top-10 kernel functions which likely consumed CPU cycles. tprof -c sleep 1 2>/dev/null | tpfmt -skCLP | head -10 DIAGNOSTICS
The tprof utility reports the following statistics about the activities of the tprof pseudo driver. sample The number of samples collected and prepared for userland consumption. overflow The number of samples dropped because the per-CPU buffer was full. buf The number of buffers successfully prepared for userland consumption. emptybuf The number of buffers which have been dropped because they were empty. dropbuf The number of buffers dropped because the number of buffers kept in the kernel exceeds the limit. dropbuf_samples The number of samples dropped because the buffers containing the samples were dropped. SEE ALSO
tpfmt(1), tprof(4) AUTHORS
The tprof utility is written by YAMAMOTO Takashi. CAVEATS
The contents and representation of recorded samples are undocumented and will likely be changed for future releases of NetBSD in an incompat- ible way. BSD
November 26, 2011 BSD
All times are GMT -4. The time now is 08:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy