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 DEBIAN
recsel
RECSEL(1) User Commands RECSEL(1)NAME
recsel - print records from a recfile
SYNOPSIS
recsel [OPTION]... [-t TYPE] [-n INDEXES | -e RECORD_EXPR | -q EXPR | -m NUM] [-c | (-p|-P) FIELD_EXPR] [FILE]...
DESCRIPTION
Select and print rec data.
-d, --include-descriptors
print record descriptors along with the matched records.
-C, --collapse
do not section the result in records with newlines.
-S, --sort=FIELD
sort the output by the specified field.
-U, --uniq
remove duplicated fields in the output records.
-s, --password=STR
decrypt confidential fields with the given password.
--help print a help message and exit.
--version
show version and exit.
Record selection options:
-i, --case-insensitive
make strings case-insensitive in selection expressions.
-t, --type=TYPE
operate on records of the specified type only.
-e, --expression=EXPR
selection expression.
-q, --quick=STR
select records with fields containing a string.
-n, --number=NUM,...
select specific records by position, with ranges.
-R, --random=NUM
select a given number of random records.
Output options:
-p, --print=FIELDS
comma-separated list of fields to print for each matching record.
-P, --print-values=FIELDS
as -p, but print only the values of the selected fields.
-R, --print-row=FIELDS
as -P, but separate the values with spaces instead of newlines.
-c, --count
print a count of the matching records instead of the records themselves.
Special options:
--print-sexps
print the data in sexps instead of rec format.
AUTHOR
Written by Jose E. Marchesi.
REPORTING BUGS
Report bugs to: bug-recutils@gnu.org
GNU recutils home page: <http://www.gnu.org/software/recutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
COPYRIGHT
Copyright (C) 2010, 2011, 2012 Jose E. Marchesi. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
The full documentation for recsel is maintained as a Texinfo manual. If the info and recsel programs are properly installed at your site,
the command
info recsel
should give you access to the complete manual.
recsel 1.4.93 January 2012 RECSEL(1)