Sponsored Content
Top Forums Shell Programming and Scripting How to parse this file using awk and output in CSV format? Post 302961061 by Franklin52 on Monday 23rd of November 2015 12:48:02 PM
Old 11-23-2015
Quote:
Originally Posted by looney
HI Franklin,
could you please explain, Why after reading line having "purchase" string in it, Script print records to next line. If it is happening due to next command , Why it is not going in next line after reading /hobby/ || !NF{next}. Because this also contains next.
Thanks,
The print command appends a newline after a string and the printf doesn't.
This User Gave Thanks to Franklin52 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to Parse a CSV file into a Different Format

Hi I have a CSV file with me in this format Currency, USD, EUR, USD, 1.00, 1.32, EUR, 0.66, 1.00, How do I transpose the file to get to the format below. currency, currency, rate USD, USD, 1.00 USD, EUR, 1.32 EUR, USD, 0.66 EUR, EUR, 1.00 Thanks for your help We are using... (2 Replies)
Discussion started by: cdesiks
2 Replies

2. Shell Programming and Scripting

AWK CSV to TXT format, TXT file not in a correct column format

HI guys, I have created a script to read 1 column in a csv file and then place it in text file. However, when i checked out the text file, it is not in a column format... Example: CSV file contains name,age aa,11 bb,22 cc,33 After using awk to get first column TXT file... (1 Reply)
Discussion started by: mdap
1 Replies

3. Shell Programming and Scripting

parse csv file, sha1 hash and output

I have a file, not really a csv, but containing delineated data just the same. Lets call that file "raw_data.txt". It contains data in the format of company name:fein number like this: first company name:123456789 second company name:987654321 what i need to do is read this file, apply... (11 Replies)
Discussion started by: FreddyG
11 Replies

4. Shell Programming and Scripting

how to parse the file in xml format using awk/nawk

Hi All, I have an xml file with the below format. <a>111</a><b>222</b><c>333<c><d><e>123</e><f>234</f><d><e>456</e><f>789</f> output needed is 111,222,333,123,234 111,222,333,456,789 nawk 'BEGIN{FS="<|>"} {print a,b,c,e,f a="" ... (7 Replies)
Discussion started by: natalie23
7 Replies

5. Shell Programming and Scripting

format output in csv file

I am sending the output of a file to .csv file. The output should look like this: Total Customers Processed:,8 Total Customers Skipped:,0 Total Customers Added:,8 Total Customers Changed:,0 Total Policies Deleted:,0 Total Policies Failed:,0 total:,8 Now i want this output in... (1 Reply)
Discussion started by: Prashant Jain
1 Replies

6. Shell Programming and Scripting

Parse file using awk and work in awk output

hi guys, i want to parse a file using public function, the file contain raw data in the below format i want to get the output like this to load it to Oracle DB MARWA1,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 MARWA2,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 this the file raw format: Number of... (6 Replies)
Discussion started by: dagigg
6 Replies

7. Shell Programming and Scripting

How to parse csv format?

Hi, I have a file with 3 fields in csv format: /tmp/foo/,MODIFY,bar/toto "/tmp/foo, bar/","ATTRIB,ISDIR","toto, tata/foobar"I would like to split fields in order to obtain the following: Line1: /tmp/foo/ MODIFY bar/totoLine2: /tmp/foo, bar/ ATTRIB,ISDIR toto, tata/foobarCan't find my way... (11 Replies)
Discussion started by: chebarbudo
11 Replies

8. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

9. Shell Programming and Scripting

Csv format output file using scirpt

Hi All, I get the test result file daily after running the main test script. from the resultfile, need to fetch only server info and status and put them in tabular format in a file and as well in CSV format output file. I tried using awk command but am not able to put them in tabluar... (6 Replies)
Discussion started by: Optimus81
6 Replies

10. Programming

Python or Shell script to Grep strings from input file and output in csv format

Hi Experts, I am writing a python script to grep string from file and display output in csv file as in attached screenshot https://drive.google.com/file/d/1gfUUdfmQma33tz65NskThYDhkZUGQO0H/view Input file(result_EPFT_config_device) Below is the python script i have prepared as of... (1 Reply)
Discussion started by: as7951
1 Replies
JOT(1)							    BSD General Commands Manual 						    JOT(1)

NAME
jot -- print sequential or random data SYNOPSIS
jot [-cnr] [-b word] [-p precision] [-s string] [-w word] [reps [begin [end [s]]]] DESCRIPTION
The jot utility is used to print out increasing, decreasing, random, or redundant data (usually numbers) one per line. The following options are available: -b word Just print word repetitively. -c This is an abbreviation for -w %c. -n Do not print the final newline normally appended to the output. -p precision Print only as many digits or characters of the data as indicated by the integer precision. In the absence of -p, the precision is the greater of the precisions of begin and end. The -p option is overridden by whatever appears in a printf(3) conversion following -w. -r Generate random data instead of sequential data, the default. -s string Print data separated by string. Normally, newlines separate data. -w word Print word with the generated data appended to it. Octal, hexadecimal, exponential, ASCII, zero padded, and right-adjusted represen- tations are possible by using the appropriate printf(3) conversion specification inside word, in which case the data are inserted rather than appended. The last four arguments indicate, respectively, the number of data, the lower bound, the upper bound, and the step size or, for random data, the seed. While at least one of them must appear, any of the other three may be omitted, and will be considered as such if given as ``-''. Any three of these arguments determines the fourth. If four are specified and the given and computed values of reps conflict, the lower value is used. If fewer than three are specified, defaults are assigned left to right, except for s, which assumes its default unless both begin and end are given. Defaults for the four arguments are, respectively, 100, 1, 100, and 1, except that when random data are requested, s defaults to a seed depending upon the time of day. reps is expected to be an unsigned integer, and if given as zero is taken to be infinite. begin and end may be given as real numbers or as characters representing the corresponding value in ASCII. The last argument must be a real number. Random numbers are obtained through random(3). The name jot derives in part from iota, a function in APL. EXAMPLES
The command: jot - 42 87 1 prints the integers from 42 to 87, inclusive. The command: jot 21 -1 1.00 prints 21 evenly spaced numbers increasing from -1 to 1. The command: jot -c 128 0 prints the ASCII character set. The command: jot -w xa%c 26 a prints the strings ``xaa'' through ``xaz''. The command: jot -r -c 160 a z | rs -g 0 8 prints 20 random 8-letter strings. The command: jot -b y 0 is equivalent to yes(1). The command: jot -w %ds/old/new/ 30 2 - 5 prints thirty ed(1) substitution commands applying to lines 2, 7, 12, etc. The command: jot 0 9 - -.5 prints the stuttering sequence 9, 8, 8, 7, etc. The command: jot -b x 512 > block creates a file containing exactly 1024 bytes. The command: expand -`jot -s, - 10 132 4` sets tabs four spaces apart starting from column 10 and ending in column 132. The command: grep `jot -s "" -b . 80` prints all lines 80 characters or longer. SEE ALSO
ed(1), expand(1), rs(1), seq(1), yes(1), printf(3), random(3) BSD
January 5, 2010 BSD
All times are GMT -4. The time now is 06:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy