Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Creating a csv file with header in UNIX Post 302795133 by Yoda on Wednesday 17th of April 2013 10:14:17 AM
Old 04-17-2013
The code uses a Conditional Expression to construct variables: f1 & f2 values

If f1 is defined, then append f1 value with comma , and first field $1 and assign to f1 else assign first field $1. Similarly for f2 but using second field $2.

In the END block, print variable values.
This User Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

creating a csv file in awk

Hi All I am trying to create a csv file in the korn shell and the script segment is as follows: if then # NEED TO ADD INFO TO THE EMAIL FILE ABOUT THE DRIVE THAT'S FILLING UP echo "$drive $percent% $space "|\ awk '{printf("%d/t"|"%d/t"|"%d/t\n",... (6 Replies)
Discussion started by: Segwar
6 Replies

2. Shell Programming and Scripting

How can I add a header to a csv file

I have a csv file which has no header. the file has 15 fields and needs to go out with a header of 8 fields. The header content needs to have some variables and some fixed that i have set up: variable header fields OUTFILE_YEAR=`date '+%y'` DATE=`date '+%d%m%y'` TIME=`date '+%H:%M:%S'`... (6 Replies)
Discussion started by: Pablo_beezo
6 Replies

3. Shell Programming and Scripting

Append Header in CSV file

Hi, I create a csv file and the output looks like below Arun,E001 Sathish,E003 Now i need to include the below header and the output should like below Name,Number Arun,E001 Sathish,E003 Please guide me. Thanks (4 Replies)
Discussion started by: Sekar1
4 Replies

4. Shell Programming and Scripting

Creating Header & Trailer for bulk volume data file

Hi all, I have a requirement to create a Header &Trailer for a file which is having 20 millions of records. If I use the following method, i think it will take more time. cat "Header"> file1.txt cat Data_File>>file1.txt cat "Trailer">>file1.txt since second CAT command has to read all... (4 Replies)
Discussion started by: Raamc
4 Replies

5. Shell Programming and Scripting

Add header to a .csv file

Hi, I am trying to add a header record to all the .csv files in a directory. I am using the below sed commnad sed -i '1 i \abc,sam,xyz,tip,pep,rip' xyz.csv but this is not adding the header and I am not getting any error,pls tell me if any thing is wrong in the code. Thanks, Shruthi (2 Replies)
Discussion started by: shruthidwh
2 Replies

6. UNIX for Dummies Questions & Answers

Merge all csv files in one folder considering only 1 header row and ignoring header of all others

Friends, I need help with the following in UNIX. Merge all csv files in one folder considering only 1 header row and ignoring header of all other files. FYI - All files are in same format and contains same headers. Thank you (4 Replies)
Discussion started by: Shiny_Roy
4 Replies

7. Shell Programming and Scripting

How to get sqlplus column header once in csv file?

Hi All, Could anyoone please let me know how do I get sqlplus column header once in csv file Scripts are below: cat concreq.sh #!/bin/bash . $HOME/.profile while ; do sqlplus apps/pwd <<-EOF set lines 100 pages 100 col "USER_CONCURRENT_QUEUE_NAME" format a40; --set termout off... (5 Replies)
Discussion started by: a1_win
5 Replies

8. Shell Programming and Scripting

Creating your own Header file in awk

whether it is possible in awk to create your own header file like in C if so someone give me awk equivalent for below one $ cat foo.h int add(int a,int b) { return(a+b); } $ cat main.c #include<stdio.h> #include"foo.h" void main() { int number1=10,number2=10,number3; number3 =... (5 Replies)
Discussion started by: Akshay Hegde
5 Replies

9. Shell Programming and Scripting

Matching the header of a .CSV file with dynamic field names

I have a .CSV file (frequency - weekly) whose header contains the year-week value in two of the columns which keeps changing every week. For an instance please see below. Column1,Column2,Column3,Column4,Column5,Column6,Column7,Column8,Column9,Column10,Column11,Column12,Column13,201420... (4 Replies)
Discussion started by: dhruuv369
4 Replies

10. Shell Programming and Scripting

Script to validate header in a csv file

Hi All; I am struggling to write a script that validates file header. Header file would be like below with TAB separated TRX # TYPE REF # Source Piece Code Destination Piece Code every time I need to check the txt file if the header was same as above fields if validation success... (6 Replies)
Discussion started by: heye18
6 Replies
WELF_PROXY2DLF.IN(1)					  LogReport's Lire Documentation				      WELF_PROXY2DLF.IN(1)

NAME
welf_proxy2dlf - convert logs in WebTrends Enhanced Log Format to proxy DLF SYNOPSIS
welf_proxy2dlf file DESCRIPTION
welf_proxy2dlf converts firewall logs in the WebTrends Enhanced Log Format into the proxy DLF. That format is defined at the following URL: http://www.netiq.com/partners/technology/welf.asp This converter also supports the SonicWall extensions. A list of firewall products that supports that format can be found at the following URL: http://www.netiq.com/products/fwr/compatible.asp EXAMPLES
To process a log as produced by a WebTrends proxy: $ welf_proxy2dlf < welf-proxy.log welf_proxy2dlf will be rarely used on its own, but is more likely called by lr_log2report: $ lr_log2report welf_proxy < /var/log/welf-proxy.log IMPLEMENTATION NOTES
Welf log files contains information about many applications: proxies, packet filters, IDS. IDS and packet filters information is handled by the firewall superservice, whereas the proxy information is handled by the proxy supersevice. This converter will only convert records with a proto, src and dst field. All other records are ignored (they won't be ignored by the firewall superservice). SEE ALSO
Lire::WELF(3) welf2dlf(1) AUTHORS
Francis J. Lacoste <flacoste@logreport.org> VERSION
$Id: welf_proxy2dlf.in,v 1.8 2006/07/23 13:16:36 vanbaal Exp $ COPYRIGHT
Copyright (C) 2001 Stichting LogReport Foundation LogReport@LogReport.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html. Lire 2.1.1 2006-07-23 WELF_PROXY2DLF.IN(1)
All times are GMT -4. The time now is 11:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy