Sponsored Content
Top Forums Shell Programming and Scripting How to get fields in reverse order? Post 302505947 by Klashxx on Friday 18th of March 2011 04:55:58 AM
Old 03-18-2011
This works for any number of fields:

Code:
 perl -ane 'chomp;print join("\|", reverse(split /\|/) )."\n" ' infile

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

using sed and regex to reverse order???

so i have been trying to learn how to manipulate text on my own and have gotten stumped... let's say i have a text file that says (highly simplified): people ordinary How would swap the order of the words.. I know i need to use sed and some kind of back reference but cannot make it... (2 Replies)
Discussion started by: urtherhoda
2 Replies

2. Shell Programming and Scripting

sort a file in reverse order

I a file with log entries... I want to sort it so that the last line in the file is first and the first line is last.. eg. Sample file 1 h a f 8 6 After sort should look like 6 8 f a h 1 (11 Replies)
Discussion started by: frustrated1
11 Replies

3. UNIX for Dummies Questions & Answers

sort -reverse order

I need to sort the particular column only in reverse order how i can give it.. if i give the -r option the whole file is getting sorted in reverse order. 1st 2nd col 3rd C col 4th col 5th col ------------------------------------------- C... (7 Replies)
Discussion started by: sivakumar.rj
7 Replies

4. Shell Programming and Scripting

cut a field, but with reverse order

Hi Everyone, I have one a.txt: a b 001 c b b 002 c c c, not 002 c The output should be 001 002 002 If i use cut -f 3 -d' ', this does not work on the 3rd line, so i thought is any way to cut the field counting from the end? or any perl thing can do this?:confused: ... (3 Replies)
Discussion started by: jimmy_y
3 Replies

5. UNIX for Dummies Questions & Answers

How to print arguments in reverse order?

Hey all, How do I make a script print its arguments in reverse order? Thanks (5 Replies)
Discussion started by: unclepickle1
5 Replies

6. UNIX for Dummies Questions & Answers

printing fields in reverse order

command/script(apart from awk) to print the fields in reverse order that is last field has to come first and so on and first field has to go last Input store-id date sale ............. ............. ... (3 Replies)
Discussion started by: tsurendra
3 Replies

7. Shell Programming and Scripting

print in reverse order

Hi, I want to print the item in reverse order such that the output would look like 00 50 50 23 40 22 02 96 Below is the input: 00 05 05 32 04 22 20 69 Video tutorial on how to use code tags in The UNIX and Linux Forums. (5 Replies)
Discussion started by: reignangel2003
5 Replies

8. Shell Programming and Scripting

Sorting strings in reverse order

Hello, I have a large database of words and would like them sorted in reverse order i.e. from the end up. An example will make this clear: I have tried to write a program in Perl which basically takes the string from the end and tries to sort from that end but it does not seem... (5 Replies)
Discussion started by: gimley
5 Replies

9. Shell Programming and Scripting

Delete records in reverse order

Hi all, i have dynamic file 'xyz.txt', records always look likes below format ... 0000021 RET 31-MAR-1984 FAP 0000021 DTA 14-JAN-2003 CNV 0000021 DTA 25-MAR-2012 DTA 0000021 DTA 26-MAR-2012 DTA ################################################# 0000021 DTA ... (4 Replies)
Discussion started by: krupasindhu18
4 Replies
mipagentstat(1M)					  System Administration Commands					  mipagentstat(1M)

NAME
mipagentstat - show Mobile IP Mobility Agent status SYNOPSIS
mipagentstat [-fhp] DESCRIPTION
Use the mipagentstat utility to display the content of various Mobile-IP related data structures. Visitor Table (First Form) The visitor table display lists information for all mobile nodes registered with the foreign agent, one mobile node per line. This list consists of the mobile node's home address or Network Access Identifier (NAI), home agent address, total registration lifetime and the num- ber of seconds remaining before the registration expires. The following command line shows the output from a foreign agent with two mobile nodes registered: example# mipagentstat -f Mobile Node Foreign Agent Time Granted Time Remaining Flags (in secs) (in secs) foobar@xyz.com fa1@tuv.com 600 125 10.1.5.23 123.2.5.12 1000 10 R An "R" in the flags column indicates a reverse tunnel is present. No reverse tunnel is configured for the mobile node foobar@xyz.com. A reverse tunnel is configured from mobile node 10.1.5.23. Binding Table (Second Form) The binding table display lists information for all mobile nodes registered with the home agent, one mobile node per line. This list con- sists of the mobile node's home address or NAI, foreign agent address, total registration lifetime and the number of seconds remaining before the registration expires. Use the following command line to show the output from a home agent with two active mobile nodes: example# mipagentstat -h Mobile Node Home Agent Time Granted Time Remaining Flags (in secs) (in secs) foobar@xyz.com ha1@xyz.com 600 125 10.1.5.23 10.1.5.1 1000 10 R An "R" in the flags column indicates a reverse tunnel is present. No reverse tunnel is configured for the mobile node foobar@xyz.com. A reverse tunnel is configured for mobile node 10.1.5.23. Agent Table (Third Form) The agent table display lists information for all current mobility agent-peers, that is all mobility agents with which mobile-nodes we are servicing are trying to obtain service. Provided in this display are the IPsec protection mechanisms being used with registration requests, replies, and tunnels. Use the following command line to show the output from a home agent with two (foreign) mobility agent peers: example# mipagentstat -hp Foreign ..... Security Association(s)..... Agent Requests Replies FTunnel RTunnel ------------------------ -------- -------- -------- -------- fa.eng.example.com AH,ESP AH,ESP AH,ESP AH,ESP fa.central.example.com AH AH ESP ESP Use the following command line to show the output from a home agent with two (foreign) mobility agent peers: example# mipagentstat -fp Home ..... Security Association(s) ..... Agent Requests Replies FTunnel RTunnel ------------------------ -------- -------- -------- -------- ha.eng.example.com AH,ESP AH,ESP AH,ESP AH,ESP ha.central.example.com Use of the -p option without specifying the agent results in both displays described above, that is one display for each agent. An AH in any column indicates the IPsec AH mechanism is in place for those datagrams. An ESP in any column indicates the IPsec ESP mechanism is in place for those datagrams. OPTIONS
The following options are supported: -f Display the list of active mobile nodes in the foreign agent's visitor's list. -h Display the list of active mobile nodes in the home agent's binding table. -p Display the list of mobility agent peers, and the IPsec protection mechanisms currently in use for registration and tunnel traf- fic. EXIT STATUS
The following exit values are returned: 0 Successful completion. non-zero An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWmipu | +-----------------------------+-----------------------------+ SEE ALSO
mipagent(1M), mipagentconfig(1M), mipagent.conf(4), attributes(5) Aboda, B., and Beadles, M. RFC 2486, The Network Access Identifier. The Internet Society, 1999. SunOS 5.10 11 Dec 2001 mipagentstat(1M)
All times are GMT -4. The time now is 09:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy