Reverse Contents Issue


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Reverse Contents Issue
# 1  
Old 05-06-2009
Reverse Contents Issue

Hi Guys,

I am a newbie to Unix. I am having a requirement. I am having a file whose contents are mentioned below:

S.no EmployeeName EmployeeID
1. MAHESH 01
2. SHANKAR 02
3. SATHEESH 03
4. RANJITH 04
5. SYED 05

Actually I want to reverse the order of the fields that is my output should be like this

EmployeeID EmployeeName S.no
01 MAHESH 1.
02 SHANKAR 2.
03 SATHEESH 3.
04 RANJITH 4.
05 SYED 5.

Is it Possible???

Appreciate ur help???

Regards,

Mahesh Raghunandanan
# 2  
Old 05-06-2009
Hammer & Screwdriver is this what you are looking for?

Code:
> cat file18
1. MAHESH 01
2. SHANKAR 02
3. SATHEESH 03
4. RANJITH 04
5. SYED 05

> awk '{print $3,$2,$1}' <file18
01 MAHESH 1.
02 SHANKAR 2.
03 SATHEESH 3.
04 RANJITH 4.
05 SYED 5.

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If contents of A are in B then move the common contents to C

Hallo Team, I have 2 .csv files file A has 47600 lines and file B has 67000 lines FILEA SD0o9rb01-1d320ddbcc8d220f572739ebed5f58d1-v300g00 SD8bt0101-a0810bfe0e3396060126ec51b30dac0a-v300g00 SD05sce01-cb056af347ed4651f29eb3c3e9addbd6-v300g00... (3 Replies)
Discussion started by: kekanap
3 Replies

2. Red Hat

DNS reverse lookup issue

Hi guys. Ok so let me lay out my configs. I can do a NSlookup from client to server BUT NOT a reverse lookup. DNS server: Optimus.jaydomain.com IP : 192.168.1.50 DNS Client: Megatron.jaydomain.com IP : 192.168.1.60 On Sever: # cat /etc/named.conf // // named.conf // // Provided... (4 Replies)
Discussion started by: Junaid Subhani
4 Replies

3. Red Hat

Configuration Reverse Proxy - https issue

Hi All I need your valuable help on this. Im trying to setup reverse proxy using apache in rhel 5.5. I just started with Apache, and not much idea about going with advance level config, except that i have tried to set up this reverse proxy based on an online guide i found in internet. The... (0 Replies)
Discussion started by: niyas_gk
0 Replies

4. Shell Programming and Scripting

Folder contents getting appended as strings while redirecting file contents to a variable

Hi one of the output of the command is as below # sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/' Resource List : <br> *************************** 1. row ***************************<br> ... (2 Replies)
Discussion started by: vivek d r
2 Replies

5. UNIX for Dummies Questions & Answers

Reverse lookup issue

I came back to my solaris 10 system after a week of being gone and xterm no longer work. I checked into it and the system doesn't reverse lookup my client system. There is a manual entry for my system in the /etc/hosts file and a forward lookup works fine, but I still can't get reverse lookup. Any... (0 Replies)
Discussion started by: clogan1981
0 Replies

6. Shell Programming and Scripting

Replace partial contents of file with contents read from other file

Hi, I am facing issue while reading data from a file in UNIX. my requirement is to compare two files and for the text pattern matching in the 1st file, replace the contents in second file by the contents of first file from start to the end and write the contents to thrid file. i am able to... (2 Replies)
Discussion started by: seeki
2 Replies

7. Shell Programming and Scripting

I want to delete the contents of a file which are matching with contents of other file

Hi, I want to delete the contents of a file which are matching with contents of other file in shell scripting. Ex. file1 sheel,sumit,1,2,3,4,5,6,7,8 sumit,rana,2,3,4,5,6,7,8,9 grade,pass,2,3,4,5,6,232,1,1 name,sur,33,1,4,12,3,5,6,8 sheel,pass,2,3,4,5,6,232,1,1 File2... (3 Replies)
Discussion started by: ranasheel2000
3 Replies

8. UNIX for Dummies Questions & Answers

compare 2 file contents , if same delete 2nd file contents

Give shell script....which takes two file names as input and compares the contents, is both are same delete second file's contents..... I try with "diff"...... but confusion how to use "diff" with if ---else Thanking you (5 Replies)
Discussion started by: krishnampkkm
5 Replies

9. UNIX for Advanced & Expert Users

How to reverse the contents of a file?

Hi Guys, Am new to this forum .... And also to shell scripting I need a k-shell script to reverse the contents of a file... Please come up with the solutions... With regards, Anand (10 Replies)
Discussion started by: aajan
10 Replies

10. UNIX for Dummies Questions & Answers

telnet refused / reverse DNS issue?

I have users with laptops who may telnet from the local network one minute and then connect remotely a short time later from a different IP address. This causes a problem as the UnixWare 7.1.1 server appears to try to resolve the remote machine name (via our primary DNS server) to the IP... (4 Replies)
Discussion started by: rm -r *
4 Replies
Login or Register to Ask a Question