Sponsored Content
Top Forums Shell Programming and Scripting awk -File contain double quotes Post 303026169 by apmcd47 on Wednesday 21st of November 2018 09:26:17 AM
Old 11-21-2018
You could look at installing csvtool or csvkit from your Linux Repository (assuming Linux here as you did not mention your OS). The former is a single program; the latter is a suite of utilities.

Both should be able to pull a single column from a CSV file (by column heading if you have one!) for you to manipulate without the confusion of quotes or even embedded linefeeds.

Andrew
 

10 More Discussions You Might Find Interesting

1. AIX

how to pass variables surrounded in double quotes to awk?

Hi, I'm making progress on this but hung up on one last detail. I'd like to use AWK to pass the system date and time(among other things) to the first line of a file. Here's what I have: BEGIN {TOTALPP = 0;FREEPP=0;USEDPP=0;print "LPAR NAME:",lpar,"DATE:",tdate } I call AWK with the... (4 Replies)
Discussion started by: cruiser
4 Replies

2. Shell Programming and Scripting

AWK removing away needed double quotes.

The below code is to convert csv file to pipe delimited. It replaces comma with pipe if it is not in double quotes; If comma is in double quotes it doesnot replace the comma with a pipe. The code works fine except it eat away the double quotes in the output file. BEGIN... (6 Replies)
Discussion started by: pinnacle
6 Replies

3. Shell Programming and Scripting

How to alias an awk command with single and double quotes?

Hi, I am trying to write the following command as an alias in my .bashrc file. bjobs -u all | awk '{if (NR > 1) {username++;}}END{{print"\nJOBS BY USER:\n"} for (i in username) {print username,i;}{print"\n Total Jobs=",NR-1,"\n" }}' The command simply puts how many jobs each user is... (2 Replies)
Discussion started by: jacekmaciek
2 Replies

4. Shell Programming and Scripting

awk - double quotes as record separator

How do I use double quotes as a record seperator in awk? (4 Replies)
Discussion started by: locoroco
4 Replies

5. Shell Programming and Scripting

Using double quotes in awk

Hi I read somewhere that when using double quotes in awk; variables gets expanded else it doesn't. So I tried to use the double quotes inside an awk statement as below: from_instance_trans=`awk "/INPUT =\"$frm_inst\"/,/<\/TRANSFORMATION>/" $xml_object | grep -w "<TRANSFIELD" | awk... (9 Replies)
Discussion started by: dips_ag
9 Replies

6. Shell Programming and Scripting

Replace double double quotes using AWK/SED

Hi, I have data as "01/22/97-"aaaaaaaaaaaaaaaaa""aaa""aabbbbbbbbcccccc""zbcd""dddddddddeeeeeeeeefffffff" I want to remove only the Consequitive double quotes and not the one which occurs single. My O/P must be ... (2 Replies)
Discussion started by: Bhuvaneswari
2 Replies

7. UNIX for Dummies Questions & Answers

awk for inserting a variable containing single and double quotes

Hi i have to insert the below line into a specific line number of another file export MBR_CNT_PRCP_TYPE_CODES_DEL="'01','02','04','05','49','55','UNK'" I have passed the above line to a variable say ins_line. I have used below command to perform the insert awk 'NR==3{print "'"${ins_line}"'"}1'... (1 Reply)
Discussion started by: sathishteradata
1 Replies

8. UNIX for Dummies Questions & Answers

Help populating double quotes using awk

Want to populate double quotes for each filed using awk: Input: cat file.txt => "1-23-test_test1-test2" Required output : "1-23-test_test1-test2"|"#GT_properties_xyz" Was trying the below command on solaris 9 machine : awk -F"|" '{print $1"|""#GT_properties_xyz"}' file.txt ... (8 Replies)
Discussion started by: rajachandhok
8 Replies

9. Shell Programming and Scripting

HELP with AWK or SED. Need to replace the commas between double quotes in CSV file

Hello experts, I need to validate a csv file which contains data like this: Sample.csv "ABCD","I",23,0,9,,"23/12/2012","OK","Street,State, 91135",0 "ABCD","I",23,0,9,,"23/12/2012","OK","Street,State, 91135",0 I just need to check if all the records contain exactly the number of... (5 Replies)
Discussion started by: shell_boy23
5 Replies

10. Shell Programming and Scripting

Replace Double quotes within double quotes in a column with space while loading a CSV file

Hi All, I'm unable to load the data using sql loader where there are double quotes within the double quotes As these are optionally enclosed by double quotes. Sample Data : "221100",138.00,"D","0019/1477","44012075","49938","49938/15043000","Television - 22" Refurbished - Airwave","Supply... (6 Replies)
Discussion started by: mlavanya
6 Replies
PMIE2COL(1)						      General Commands Manual						       PMIE2COL(1)

NAME
pmie2col - convert pmie output to multi-column format SYNOPSIS
pmie2col [-d delimiter] [-p precision] [-w width] DESCRIPTION
pmie2col is a simple tool that converts output from pmie(1) into regular column format. Each column is 7 characters wide (by default, may be changed with the -w option) with a single space between columns. That single space can be substituted with an alternate delimiter using the -d option (this is useful for importing the data into a spreadsheet, for example). The precision of the tabulated values from pmie can be specified with the -p option (default is 2 decimal places). This option can and will override any width setting in order to present the requested precision. The pmie(1) configuration must follow these rules: (1) Each pmie(1) expression is of the form ``NAME = expr;''. NAME will be used as the column heading, and must contain no white space, although special characters can be escaped by enclosing NAME in single quotes. (2) The ``expr'' must be a valid pmie(1) expression that produces a singular value. In addition, pmie(1) must be run with the -v command line option. It is also possible to use the -e command line to pmie(1) and output lines will be prefixed by a timestamp. EXAMPLE
Given this pmie(1) configuration file (config): loadav = kernel.all.load #'1 minute'; '%usr' = kernel.all.cpu.user; '%sys' = kernel.all.cpu.sys; '%wio' = kernel.all.cpu.wait.total; '%idle' = kernel.all.cpu.idle; 'max-iops' = max_inst(disk.dev.total); Then this command pipeline: $ pmie -v -t 5 <config | pmie2col -w 8 Produces output like this: loadav %usr %sys %wio %idle max-iops 0.21 ? ? ? ? ? 0.36 0.49 0.03 0.18 0.29 25.40 0.49 0.41 0.10 0.36 0.13 51.00 0.69 0.49 0.10 0.05 0.37 43.20 0.71 0.39 0.08 0.04 0.49 14.00 0.83 0.63 0.15 0.00 0.21 32.30 1.09 0.60 0.02 0.10 0.27 47.00 0.92 0.01 0.00 0.00 0.99 2.40 PCP ENVIRONMENT
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configura- tion file, as described in pcp.conf(5). SEE ALSO
PCPIntro(1) and pmie(1). Performance Co-Pilot PCP PMIE2COL(1)
All times are GMT -4. The time now is 04:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy