The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Transposing column to row, joining with another file, then sorting columns doobedoo Shell Programming and Scripting 2 10-02-2009 01:50 PM
Transposing a file vikas_kesarwani Shell Programming and Scripting 14 09-02-2008 10:28 PM
More than transposing! bulash UNIX Desktop for Dummies Questions & Answers 3 04-11-2008 05:20 PM
Another transposing issue stevesmith Shell Programming and Scripting 14 09-16-2006 04:48 AM
file transposing mskcc Shell Programming and Scripting 24 08-04-2005 11:23 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 1 Week Ago
46019 46019 is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 9
Transposing a file

Hi All,
I have a input file say FILEA.

FILEA
--------
empid1
sal1
location1
manager1
empid2
sal2
location2
manager2
empid3
sal3
location3
manager3
.
.
.

the output file (FILEB) should look like:

FILEB
---------
empid1,sal1,location1,manager1
empid2,sal2,location2,manager2
empid3,sal3,location3,manager3
.
.
.

Please help me in this regard

Thanks in advance...
  #2 (permalink)  
Old 1 Week Ago
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,502
Code:
 awk '/empid/ && NR>1{ print "";}{printf "%s ",$0}' file
  #3 (permalink)  
Old 1 Week Ago
Scrutinizer Scrutinizer is online now
Registered User
  
 

Join Date: Nov 2008
Posts: 585
Code:
xargs -n4 < infile | sed 's/ /,/g'
  #4 (permalink)  
Old 1 Week Ago
summer_cherry summer_cherry is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2007
Location: Beijing China
Posts: 1,078
Code:
 paste -d"," - - - -
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:28 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0