The UNIX and Linux Forums  

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
Difference between @# and @* rochitsharma UNIX for Advanced & Expert Users 3 07-03-2006 04:24 PM
What is the difference thunderfastfox UNIX for Dummies Questions & Answers 1 12-07-2005 11:22 PM
difference between ksh and bsh tads98 Shell Programming and Scripting 4 08-10-2005 06:05 AM
difference rajashekaran UNIX for Advanced & Expert Users 1 04-23-2002 02:59 AM
Where is the difference? Fwurm UNIX for Dummies Questions & Answers 3 02-13-2002 03:07 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-18-2009
narang.mohit narang.mohit is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 17
tranpose but some difference

hi i have some data
like
1
2
3
4
5
6
7
8

i want to arrange like this
1 2
3 4
5 6
7 8
  #2 (permalink)  
Old 03-18-2009
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131

Code:
nawk 'ORS=(FNR%2)?FS:RS' somedata

  #3 (permalink)  
Old 03-18-2009
summer_cherry summer_cherry is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2007
Location: Beijing China
Posts: 1,098

Code:
cat filename | paste -d" " - -

  #4 (permalink)  
Old 03-18-2009
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,558
Quote:
Originally Posted by summer_cherry View Post
Code:
cat filename | paste -d" " - -

Code:
# cat file | paste -d" " - -
 2
 4
 6
 8

  #5 (permalink)  
Old 03-18-2009
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,558
Quote:
Originally Posted by vgersh99 View Post
Code:
nawk 'ORS=(FNR%2)?FS:RS' somedata
i did not get the output.

Code:
# awk 'ORS=(FNR%2)?FS:RS' file
 2
 4
 6
 8

  #6 (permalink)  
Old 03-18-2009
rikxik's Avatar
rikxik rikxik is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 250
It has to be some issue with your file. I got correct output from both commands:


Code:
$ paste -d" " - - < file1
1 2
3 4
5 6
7 8
$ nawk 'ORS=(FNR%2)?FS:RS' file1
1 2
3 4
5 6
7 8

  #7 (permalink)  
Old 03-19-2009
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,558
yes, that's it. dos format. dos2unix fixed it.
Closed Thread

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 04:21 PM.


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