02-29-2008
creating a CSV in awk
Thanks ...
appreciate your prompt response
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi I am Newbie to Unix.Appreciate Help from forum
user would loada b.Csv File(Below example) in /data/m/ directory.Program need to read the b.csc to extract certain column and create a new file /data/d/ directory as csv file with new name.
User File Format
1232,samshouston,12345... (3 Replies)
Discussion started by: skywayterrace
3 Replies
2. UNIX for Advanced & Expert Users
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
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
4. UNIX for Dummies Questions & Answers
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
5. Shell Programming and Scripting
Hello,
I don't understand why the script below doesn't act the way it should :
#!/bin/sh
awk 'BEGIN{printf("Entrez la date : "); getline date < "-"}
$0 ~ date {f=1;print;next}
/^{2}\//{f=0}
f' Planning.csv > planning.txt
It doesn't create file planning.txt with only the result of... (14 Replies)
Discussion started by: freyr
14 Replies
6. Shell Programming and Scripting
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
7. UNIX for Dummies Questions & Answers
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
8. Shell Programming and Scripting
hi
i have written a script for reading a csv file and creating a flat file, suggest if this script can be optimized
#----------------
FILENAME="$1"
SCRIPT=$(basename $0)
#-----------------------------------------//
function usage
{
echo "\nUSAGE: $THIS_SCRIPT file_to_process\n"... (3 Replies)
Discussion started by: mprakasheee
3 Replies
9. UNIX for Dummies Questions & Answers
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
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
LEARN ABOUT OPENSOLARIS
errint
ckint(1) User Commands ckint(1)
NAME
ckint, errint, helpint, valint - display a prompt; verify and return an integer value
SYNOPSIS
ckint [-Q] [-W width] [-b base] [-d default] [-h help]
[-e error] [-p prompt] [-k pid [-s signal]]
/usr/sadm/bin/errint [-W width] [-b base] [-e error]
/usr/sadm/bin/helpint [-W width] [-b base] [-h help]
/usr/sadm/bin/valint [-b base] input
DESCRIPTION
The ckint utility prompts a user, then validates the response. It defines, among other things, a prompt message whose response should be an
integer, text for help and error messages, and a default value (which will be returned if the user responds with a carriage return).
All messages are limited in length to 70 characters and are formatted automatically. Any white space used in the definition (including new-
line) is stripped. The -W option cancels the automatic formatting. When a tilde is placed at the beginning or end of a message definition,
the default text will be inserted at that point, allowing both custom text and the default text to be displayed.
If the prompt, help or error message is not defined, the default message (as defined under NOTES) will be displayed.
Three visual tool modules are linked to the ckint command. They are errint (which formats and displays an error message), helpint (which
formats and displays a help message), and valint (which validates a response). These modules should be used in conjunction with FML
objects. In this instance, the FML object defines the prompt. When base is defined in the errint and helpint modules, the messages will
include the expected base of the input.
OPTIONS
The following options are supported:
-b base Defines the base for input. Must be 2 to 36, default is 10.
-d default Defines the default value as default. The default is not validated and so does not have to meet any criteria.
-e error Defines the error message as error.
-h help Defines the help messages as help.
-k pid Specifies that process ID pid is to be sent a signal if the user chooses to abort.
-p prompt Defines the prompt message as prompt.
-Q Specifies that quit will not be allowed as a valid response.
-s signal Specifies that the process ID pid defined with the -k option is to be sent signal signal when quit is chosen. If no signal
is specified, SIGTERM is used.
-W width Specifies that prompt, help and error messages will be formatted to a line length of width.
OPERANDS
The following operand is supported:
input Input to be verified against base criterion.
EXIT STATUS
The following exit values are returned:
0 Successful execution.
1 EOF on input, or negative width on -W option, or usage error.
3 User termination (quit).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
attributes(5)
NOTES
The default base 10 prompt for ckint is:
Enter an integer [?,q]:
The default base 10 error message is:
ERROR - Please enter an integer.
The default base 10 help message is:
Please enter an integer.
The messages are changed from "integer" to "base base integer" if the base is set to a number other than 10.
When the quit option is chosen (and allowed), q is returned along with the return code 3. The valint module will not produce any output. It
returns 0 for success and non-zero for failure.
SunOS 5.11 14 Sep 1992 ckint(1)