Print records which do not have expected number of fields in a comma delimited file
Hi,
I have a comma (,) delimited file, in which few fields are enclosed with in double quotes " ". I have to print the records in the file which donot have expected number of field with the line number.
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)
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)
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)
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)
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)
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)
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)
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)
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 BSD
sortbib
SORTBIB(1) General Commands Manual SORTBIB(1)NAME
sortbib - sort bibliographic database
SYNOPSIS
sortbib [ -sKEYS ] database ...
DESCRIPTION
Sortbib sorts files of records containing refer key-letters by user-specified keys. Records may be separated by blank lines, or by .[ and
.] delimiters, but the two styles may not be mixed together. This program reads through each database and pulls out key fields, which are
sorted separately. The sorted key fields contain the file pointer, byte offset, and length of corresponding records. These records are
delivered using disk seeks and reads, so sortbib may not be used in a pipeline to read standard input.
By default, sortbib alphabetizes by the first %A and the %D fields, which contain the senior author and date. The -s option is used to
specify new KEYS. For instance, -sATD will sort by author, title, and date, while -sA+D will sort by all authors, and date. Sort keys
past the fourth are not meaningful. No more than 16 databases may be sorted together at one time. Records longer than 4096 characters
will be truncated.
Sortbib sorts on the last word on the %A line, which is assumed to be the author's last name. A word in the final position, such as
``jr.'' or ``ed.'', will be ignored if the name beforehand ends with a comma. Authors with two-word last names or unusual constructions
can be sorted correctly by using the nroff convention `` '' in place of a blank. A %Q field is considered to be the same as %A, except
sorting begins with the first, not the last, word. Sortbib sorts on the last word of the %D line, usually the year. It also ignores lead-
ing articles (like ``A'' or ``The'') when sorting by titles in the %T or %J fields; it will ignore articles of any modern European lan-
guage. If a sort-significant field is absent from a record, sortbib places that record before other records containing that field.
SEE ALSO refer(1), addbib(1), roffbib(1), indxbib(1), lookbib(1)AUTHORS
Greg Shenaut, Bill Tuthill
BUGS
Records with missing author fields should probably be sorted by title.
4.2 Berkeley Distribution April 29, 1985 SORTBIB(1)