01-31-2012
awk -F "," '/"/{print NR,$0}' file
This will help you.
Output-:
2 asath,se,15-06-2010,asc,"india,mumbai"
5 mthr,"ase,trans",15-09-2010
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Can anyone let me know on how to convert a Tab delimited file to Comma delimited file in Unix
Thanks!! (22 Replies)
Discussion started by: charan81
22 Replies
2. Shell Programming and Scripting
I have a situation where I am reading a text file line-by-line. Those lines of data contain comma separated fields of data. However, each line can vary in the number of fields it can contain. What I need to do is parse apart each line and write each field of data found (left to right) into a file.... (7 Replies)
Discussion started by: 2reperry
7 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I have a comma delimited file. I want to sort the fields alphabetically and again store them in a comma delimited file.
For example, My file looks like this.
abc,aaa,xyz,xxx,def
pqr,ggg,eee,iii,qqq
zyx,lmo,pqr,abc,fff
and I want my output to look like this, all fields sorted... (3 Replies)
Discussion started by: swethapatil
3 Replies
4. UNIX for Dummies Questions & Answers
Hello all,
Would appreciate if someone can help me out on the following requirement.
INPUT FILE:
--------------------------
TPS REPORT
abc def ghi
jkl mon pqr
stu vrs lll
END OF TPS REPORT
TPS REPORT
field1 field2 field3
field4 field5 field6 (8 Replies)
Discussion started by: hyennah
8 Replies
5. UNIX for Advanced & Expert Users
I'm facing a strange problem, please help me out.
Here we go.
I want to count number of fields in particular file.
filename and delimiter character will be passed through parameter.
On command prompt if i type following i get 27 as output (which is correct)
cat customer.dat | head -1 | awk... (12 Replies)
Discussion started by: vikanna
12 Replies
6. Shell Programming and Scripting
I have a comma (,) delimited file.
106232145,"medicare","medicare,medicaid",789
I would like to count the number of fields in each line.
I tried the below code
awk -F ',' '{print NF-1}'
This returns me the result as 5 instead of 4. This is because the awk takes... (9 Replies)
Discussion started by: machomaddy
9 Replies
7. UNIX for Dummies Questions & Answers
Hi everyone,
i have a file that I had grep'd from something else lets call it file1.txt which consists variable files and lines due to different scenarios/inputs
1782
9182
fe35
ac67
how can I print this in this manner?
1782,9182,fe35,ac67
also if i had piped the new output... (2 Replies)
Discussion started by: prodigy06
2 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I am not sure if I've posted this question before.
Anyway, I previously asked about converting lines of text into a comma delimited string. Now I am needing to do the other way around ... :( :o
Can anyone advise how is this possible?
Example as below:
Converting records/lines to... (2 Replies)
Discussion started by: newbie_01
2 Replies
9. UNIX for Dummies Questions & Answers
Hi,
input:
AA|BB|CC
DD|EE
FF
what I am trying to get:
AA|BB|CC
DD|EE|
FF||
I tried to create first an UDF for printing repeats, but I think I have an issue with my END section or my array:
function repeat(str, n, rep, i)
{
for(i=1 ;i<n;i++)
rep=rep str
return rep
}
... (6 Replies)
Discussion started by: beca123456
6 Replies
10. UNIX for Beginners Questions & Answers
Hi,
Apologies in advance to the moderator if I am posting this the wrong way.
I've searched and found the solution to an old post but as it is a very old post, I don't see an option to update it with additional question.
The question I have is in relation to the following post:
How to... (6 Replies)
Discussion started by: newbie_01
6 Replies
LEARN ABOUT SUNOS
praudit
praudit(1M) System Administration Commands praudit(1M)
NAME
praudit - print contents of an audit trail file
SYNOPSIS
praudit [-lrsx] [-ddel] [filename...]
DESCRIPTION
praudit reads the listed filenames (or standard input, if no filename is specified) and interprets the data as audit trail records as
defined in audit.log(4). By default, times, user and group IDs (UIDs and GIDs, respectively) are converted to their ASCII representation.
Record type and event fields are converted to their ASCII representation. A maximum of 100 audit files can be specified on the command
line.
OPTIONS
The following options are supported:
-ddel Use del as the field delimiter instead of the default delimiter, which is the comma. If del has special meaning for the shell, it
must be quoted. The maximum size of a delimiter is three characters. The delimiter is not meaningful and is not used when the -x
option is specified.
-l Print one line per record.
-r Print records in their raw form. Times, UIDs, GIDs, record types, and events are displayed as integers. This option and the -s
option are exclusive. If both are used, a format usage error message is output.
-s Print records in their short form. All numeric fields are converted to ASCII and displayed. The short ASCII representations for
the record type and event fields are used. This option and the -r option are exclusive. If both are used, a format usage error
message is output.
-x Print records in XML form. Tags are included in the output to identify tokens and fields within tokens. Output begins with a valid
XML prolog, which includes identification of the DTD which can be used to parse the XML.
FILES
/etc/security/audit_event Audit event definition and class mappings.
/etc/security/audit_class Audit class definitions.
/usr/share/lib/xml/dtd Directory containing the verisioned DTD file referenced in XML output, for example, adt_record.dtd.1.
/usr/share/lib/xml/style Directory containing the versioned XSL file referenced in XML output, for example, adt_record.xsl.1.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|Interface Stability |See below |
+-----------------------------+-----------------------------+
The command stability is evolving. The output format is unstable.
SEE ALSO
bsmconv(1M), audit(2), getauditflags(3BSM), audit.log(4), audit_class(4), audit_event(4), group(4), passwd(4), attributes(5)
NOTES
This functionality is available only if the Basic Security Module (BSM) has been enabled. See bsmconv(1M) for more information.
SunOS 5.10 6 Jan 2003 praudit(1M)