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
Replacing nulls using sed novice1324 Shell Programming and Scripting 7 02-27-2008 03:56 AM
Replacing in SED superprogrammer Shell Programming and Scripting 8 07-11-2006 02:33 AM
replacing corrupt /tmp dir.. moxxx68 UNIX for Advanced & Expert Users 6 05-28-2005 06:58 PM
replacing with `pwd` oldtrash Shell Programming and Scripting 6 04-09-2004 06:24 PM
replacing \n by \r\n crashnburn UNIX for Dummies Questions & Answers 3 11-24-2003 03:49 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-30-2007
zedex zedex is offline
Registered User
  
 

Join Date: Feb 2007
Location: india,mumbai
Posts: 138
help in replacing ??

hi all

i have input file like this abc.txt
Code:
filename.out:
<TAB>ABC<TAB>9
<TAB>AKC<TAB>1
filename1.out:
<TAB>XYZ<TAB>1
<TAB>XYN<TAB>4
and i am trying to replace \n\t with \t so that output will be like this:
Code:
filename.out:<TAB>ABC<TAB>9<TAB>AKC<TAB>1
filename1.out:<TAB>XYZ<TAB>1<TAB>AYN<TAB>4<TAB>
i am using
perl -pi -e 's/\n\t/\t' abc.txt

its not working but when i do it from vim it works is ther any other command to do the same task
  #2 (permalink)  
Old 08-30-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,643
Code:
tr -s '\n' '\t' < filename.out > newfile
  #3 (permalink)  
Old 08-30-2007
ahmedwaseem2000 ahmedwaseem2000 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Bangalore
Posts: 219
Try this:

Code:
awk ' BEGIN { ORS="" };/^filename/{ if ( NR != 1) print "\n" };{ print }' FIlename
  #4 (permalink)  
Old 08-30-2007
kamitsin's Avatar
kamitsin kamitsin is offline
Registered User
  
 

Join Date: Nov 2006
Location: /dev/null
Posts: 177
Code:
cat abc.txt | xargs -n3
  #5 (permalink)  
Old 08-31-2007
zedex zedex is offline
Registered User
  
 

Join Date: Feb 2007
Location: india,mumbai
Posts: 138
help in replacing ??

hi all

i have input file like this abc.txt
Code:
filename.out:
<TAB>ABC<TAB>9
<TAB>AKC<TAB>1
filename1.out:
<TAB>XYZ<TAB>1
<TAB>XYN<TAB>4
and i am trying to replace \n\t with \t so that output will be like this:
Code:
filename.out:<TAB>ABC<TAB>9<TAB>AKC<TAB>1
filename1.out:<TAB>XYZ<TAB>1<TAB>AYN<TAB>4<TAB>
i am using
perl -pi -e 's/\n\t/\t' abc.txt

its not working but when i do it from vim it works is ther any other command to do the same task
  #6 (permalink)  
Old 08-31-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,422
Quote:
Originally Posted by kamitsin View Post
Code:
cat abc.txt | xargs -n3
cat is not needed
Code:
xargs -n3 < file
Sponsored Links
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 07:06 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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