Hi All,
I want to sort a flat file which will contain millions of records based on a key/field. For this I want to use unix sort command and before that I want to make sure that unix sort command has any file size limitations. And also please let me know whether I have to change any... (1 Reply)
Hi All,
I want to sort a flat file which will contain millions of records based on a key/field. For this I want to use unix sort command and before that I want to make sure that unix sort command has any file size limitations. And also please let me know whether I have to change any... (2 Replies)
I am converting mainframes JCL to be used in shell on a one to one basis... when i use the sort command unix does ascii sort as a result which numbers are first followed by charecters in the Ascending sort ... but themainframes uses the EBCDIC as result gives the charecters followed by numbers in... (5 Replies)
Hey guys.
I am trying to sort a file by account number through UNIX. I have a few things but it seems to sort by account number AND sort everything after the account number.
Help please.
Thanks (5 Replies)
I was trying to check for the sort of some columns (say 1-10) of particular file. Now, by default, the Unix sort uses as a separator whitespace (e.g. if you have 'foo bar' then it separates it into 'foo' and 'bar' to use as keys)
Now, I know which particular columns I want to use as the sort... (1 Reply)
Hi I am having some difficulties with the UNIX sort command.
I want to sort one a file that looks like this (file A):
tiger 5 6 3 5 2
bear 4 5 2 1 8
lions 9 2 5 3 1
dogs 8 5 3 3 1
acccording to a file that looks like this (file B):
dogs
lions
tiger
bear
So... (2 Replies)
Need some help with the sort command. I have a large file which needs sorted on the third field separated by : and within the third field, I need it sorted by second field or everything after the . An example of my file is here and for example, the first line I need :ROUTER2.SFLDMI: sorted on the... (2 Replies)
Hi i have a file like this
oprvdw vrc002093j.ksh
oprvdw vrc002092j.ksh
oprvrc vrc045016j.ksh
oprvrc vrc055141j.ksh
svemietl bdw0231185.sh
svemietl bdw0231145.sh
and i need a script which dispalys in below format:
oprvdw :
vrc002093j.ksh
vrc002092j.ksh
oprvrc :... (0 Replies)
Hi All,
I am trying to sort the below data using sort command.
temp.dat
H|S1-511091486889|27-Jul-2011 00:00:00
H|S1-511091486823|27-Jul-2011 00:00:00
H|S1-511091486757|27-Jul-2011 00:00:00
L|S1-511091486889|1
L|S1-511091486823|1
L|S1-511091486757|1
sort -t "|" -k2 -k1 temp.dat
My... (5 Replies)
Hi I have below pattern
A: Apple 2 B:Bolls 4 total_count = 6
A: pens 4 B:Bags 4 total count = 8
A: pens 4 B:Bags 4
A: cells 6
A: jobs 6
Output I need :
A: Apple 2 B:Bolls 4 total_count = 6
A: pens 4 B:Bags 4 total count = 8
A: cells 6
A: jobs 6
... (7 Replies)
Discussion started by: pkkanduk
7 Replies
LEARN ABOUT FREEBSD
xo_open_instance_d
LIBXO(3) BSD Library Functions Manual LIBXO(3)NAME
xo_emit -- emit formatted output based on format string and arguments
LIBRARY
library ``libxo''
SYNOPSIS
#include <libxo/xo.h>
LIBXO(3) BSD Library Functions Manual LIBXO(3)NAME
xo_open_list
xo_open_list_h
xo_open_list_hd
xo_open_list_d
xo_open_instance
xo_open_instance_h
xo_open_instance_hd
xo_open_instance_d
xo_close_instance
xo_close_instance_h
xo_close_instance_hd
xo_close_instance_d
xo_close_list
xo_close_list_h
xo_close_list_hd
xo_close_list_d -- open and close lists and instances
LIBRARY
library ``libxo''
SYNOPSIS
int
xo_open_list_h(xo_handle_t *xop, const char *name);
int
xo_open_list(const char *name);
int
xo_open_list_hd(xo_handle_t *xop, const char *name);
int
xo_open_list_d(const char *name);
int
xo_open_instance_h(xo_handle_t *xop, const char *name);
int
xo_open_instance(const char *name);
int
xo_open_instance_hd(xo_handle_t *xop, const char *name);
int
xo_open_instance_d(const char *name);
int
xo_close_instance_h(xo_handle_t *xop, const char *name);
int
xo_close_instance(const char *name);
int
xo_close_instance_hd(xo_handle_t *xop);
int
xo_close_instance_d(void);
int
xo_close_list_h(xo_handle_t *xop, const char *name);
int
xo_close_list(const char *name);
int
xo_close_list_hd(xo_handle_t *xop);
int
xo_close_list_d(void);
DESCRIPTION
Lists are sequences of instances of homogeneous data objects. Two distinct levels of calls are needed to represent them in our output
styles. Calls must be made to open and close a list, and for each instance of data in that list, calls must be make to open and close that
instance.
The name given to all calls must be identical, and it is strongly suggested that the name be singular, not plural, as a matter of style and
usage expectations.
A list is a set of one or more instances that appear under the same parent. The instances contain details about a specific object. One can
think of instances as objects or records. A call is needed to open and close the list, while a distinct call is needed to open and close
each instance of the list:
xo_open_list("item");
for (ip = list; ip->i_title; ip++) {
xo_open_instance("item");
xo_emit("{L:Item} '{:name/%s}':0, ip->i_title);
xo_close_instance("item");
}
xo_close_list("item");
Getting the list and instance calls correct is critical to the proper generation of XML and JSON data.
EXAMPLE:
xo_open_list("user");
for (i = 0; i < num_users; i++) {
xo_open_instance("user");
xo_emit("{k:name}:{:uid/%u}:{:gid/%u}:{:home}0,
pw[i].pw_name, pw[i].pw_uid,
pw[i].pw_gid, pw[i].pw_dir);
xo_close_instance("user");
}
xo_close_list("user");
TEXT:
phil:1001:1001:/home/phil
pallavi:1002:1002:/home/pallavi
XML:
<user>
<name>phil</name>
<uid>1001</uid>
<gid>1001</gid>
<home>/home/phil</home>
</user>
<user>
<name>pallavi</name>
<uid>1002</uid>
<gid>1002</gid>
<home>/home/pallavi</home>
</user>
JSON:
user: [
{
"name": "phil",
"uid": 1001,
"gid": 1001,
"home": "/home/phil",
},
{
"name": "pallavi",
"uid": 1002,
"gid": 1002,
"home": "/home/pallavi",
}
]
LEAF LISTS
In contrast to a list of instances, a "leaf list" is list of simple values. To emit a leaf list, call the xo_emit() function using the ""l""
modifier:
for (ip = list; ip->i_title; ip++) {
xo_emit("{Lwc:Item}{l:item}0, ip->i_title);
}
The name of the field must match the name of the leaf list.
In JSON, leaf lists are rendered as arrays of values. In XML, they are rendered as multiple leaf elements.
JSON:
"item": "hammer", "nail"
XML:
<item>hammer</item>
<item>nail</item>
ADDITIONAL DOCUMENTATION
Complete documentation can be found on github:
http://juniper.github.io/libxo/libxo-manual.html
libxo lives on github as:
https://github.com/Juniper/libxo
The latest release of libxo is available at:
https://github.com/Juniper/libxo/releases
SEE ALSO xo_emit(3)HISTORY
The libxo library was added in FreeBSD 11.0.
AUTHOR
Phil Shafer
BSD December 4, 2014 BSD