Sponsored Content
Top Forums Shell Programming and Scripting help!!!!!! in creating csv report Post 302141175 by xander on Thursday 18th of October 2007 03:19:08 AM
Old 10-18-2007
Dear Summer_cherry
Thanks for your help

firstly i have gawk installed on Linux box and when i run your code with gawk
HTML Code:
gawk 'BEGIN{flag=0;num=1}
/^contact/ 
{
	contact[num]=substr($0,length($1)+1,length($0)-length($1))
}
/^user_id/ 
{
	user[num]=substr($0,length($1)+1,length($0)-length($1))
}
/^display_name/ 
{
	display[num]=substr($0,length($1)+1,length($0)-length($1));
}
/^comments/
{
	flag=1
	next
}
flag {  tmp=tmp$0  }
/^description/ 
{
	description[num]=substr($0,length($1)+1,length($0)-length($1))
	comments[num]=tmp
	tmp=""
	flag=0
}
/^account_no/ 
{
	account[num]=substr($0,length($1)+1,length($0)-length($1))
}
/^email/ 
{
	email[num]=substr($0,length($1)+1,length($0)-length($1));num++
}
END{
for (i=1;i<=num-1;i++)
	print contact[i]","user[i]","display[i]","description[i]","account[i]","email[i]","comments[i]
}' filename
all I m getting is
HTML Code:
contact_date  2007-08-15 00:00:22
user_id       074631
display_name  xander
comments
contact_date  2007-08-15 00:00:27
user_id       074612
display_name  joe
comments
contact_date  2007-08-15 00:00:46
user_id       75129
display_name  philip
comments
contact_date  2007-08-15 00:04:35
user_id       76547
display_name  hsingh
comments
contact_date  2007-08-15 00:05:06
user_id       76374
display_name  shivk
comments
Thanks
 

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. UNIX for Advanced & Expert Users

Creating multiple worksheets in CSV file

Hello, I've been tasked with sending 3 types of data (file size, row count, and file name) to a csv file every month for various vendors. I have been asked to put this in one csv or xls file with each vendor being a different tab (or worksheet). Until now, we have been finding and emailing... (4 Replies)
Discussion started by: tekster757
4 Replies

3. UNIX for Dummies Questions & Answers

Creating CSV Files

I have a requiremnt to create one CSV file with initial 5 lines as blank rows. From 5th row onwards the file is to be created from a list of varibales which gets evaluated. Say A,B,C,D,E are 5 varibales with some value associated with each of them and data type is string. So the 6th row should... (1 Reply)
Discussion started by: dr46014
1 Replies

4. UNIX for Dummies Questions & Answers

creating a CSV file for past 7 days

I have a requirement which will select the files with a specific naming convention which got created in past 7 days in a specific directory.Lets say the directory is /data/XYZ and the file names follow the below nomenclature like Daily_File*.txt I just need to create one CSV file which will... (12 Replies)
Discussion started by: dr46014
12 Replies

5. Shell Programming and Scripting

Creating CSV files

hi, Need a lil help experts. i have a sh file and its calling one SQL file. i need the dataset returned by that SQL file in a CSV format. Can you plz help me out at the earliest. waiting eagerly .. :confused: Thanks.. (10 Replies)
Discussion started by: onlyniladri
10 Replies

6. UNIX for Dummies Questions & Answers

Creating a report from csv file.

Hi Gurus, I need your help in transforming the CSV file into some what a report format. My source file looks like below Date,ProdID,TimeID,LevelID 2010-08-31,200,M,1 2010-08-31,201,Q,2 2010-08-31,202,Y,1 2010-08-31,203,M,5 Output required is ... (9 Replies)
Discussion started by: naveen.kuppili
9 Replies

7. Shell Programming and Scripting

creating a csv file from this 1 liner?

I'm trying to create a csv file by running awk and sed on a number of xml files in a directory; I'm using this below: hostname; grep "BuildDate" /dir/ABCD/configuration/*/*.xml | awk -F"/" '{ print $5 }' > /tmp/tempfile.txt; grep "BuildDate" /dir/ABCD/configuration/*/*.xml | awk -F\" '{ print $2... (2 Replies)
Discussion started by: rich@ardz
2 Replies

8. UNIX for Dummies Questions & Answers

Problem in creating CSV file

Hi guys, I am not experienced with Unix, so please dont mind if the question seem to be irrelevant. I have written a simple script, that connects DB & fetches few records from a table. I wanted to get those details as file in .CSV format via mail. -I stored the query o/p in a file. -I... (6 Replies)
Discussion started by: sumitburnwal88
6 Replies

9. UNIX for Dummies Questions & Answers

Creating a csv file with header in UNIX

I have a flat file that contains dynamic list of variables like a=1 b=2 c=3 . .. z=26 I need to convert the above into a csv file having the format below: a,b,c,..,z 1,2,3,..,26 Please note, I do not want a comma separating the last variable. I tried to refer the post... (4 Replies)
Discussion started by: vkumbhakarna
4 Replies

10. Shell Programming and Scripting

Need help for creating the report

Hi, I have a file that contains below information: provider APESD APESD Annual Turn $67000 Provider XXXX Annual Turn $92000 Provider FERHG FERHG Annual Turn $56700 Provider ABXX Annual Turn $99000 These are just sample rows out of some 5000. I want to create a tabular report as... (5 Replies)
Discussion started by: juzz4fun
5 Replies
RUBBER-INFO(1)						      General Commands Manual						    RUBBER-INFO(1)

NAME
rubber-info - extract information from LaTeX documents SYNOPSIS
rubber-info [options] [action] source DESCRIPTION
Rubber-info is a utility for extracting various kinds of information from a LaTeX document. Information can be extracted from the source (for instance when calculating dependencies) or from the compilation log files (to extract errors and warnings). This program is a comple- ment for the compilation system rubber(1). The command-line options are those used by rubber(1) plus one of the actions described below. ACTIONS
One of the following command-line options must be specified, to decide which information to extract. Of course, for actions that read a log file, a compilation must have been done before. If none of these actions is specified, --check is assumed. --boxes Extracts from the log file the places in the source where bad boxes appeared (these are the famous overfull and underfull hbox and vbox) --check Report errors if there are any, otherwise report undefined references if there are any, otherwise list warnings and bad boxes. This is the default action. --deps Analyse the source files and produce a space-separated list of all the files that the document depends on and that Rubber cannot rebuild. --errors Extract from the log file the list of errors that occured during the last compilation. -h, --help Display the list of all available options and exit nicely. --refs Report the list of undefined or multiply defined references (i.e. the ef's that are not defined by one label). --rules Analyse the source files and produce a list of dependency rules. One rule is produced for each intermediate target that would be made when running rubber. Rules are formatted in the style of Makefiles. --version Print the version number and exit nicely. --warnings Stupidly enumerate all LaTeX warnings, i.e. all the lines in the log file that contain the string "Warning". BUGS
There are surely a some... This page documents Rubber version 1.1. The program and this man-page are maintained by Emmanuel Beffara <manu@beffara.org>. The homepage for Rubber can be found at http://www.pps.jussieu.fr/~beffara/soft/rubber/. SEE ALSO
The full documentation for rubber is maintained as a Texinfo manual. If the info and rubber programs are properly installed at your site, the command info rubber should give you access to the complete manual. RUBBER-INFO(1)
All times are GMT -4. The time now is 10:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy