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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Building Full-Text Search Applications with Oracle Text iBot Oracle Updates (RSS) 0 04-06-2008 02:10 AM
c program to extract text between two delimiters from some text file kukretiabhi13 High Level Programming 5 01-22-2008 01:42 AM
Copying Text between two unique text patterns spindoctor UNIX for Dummies Questions & Answers 2 05-28-2007 12:15 PM
text formating/Text space padding hugow UNIX for Dummies Questions & Answers 6 06-29-2005 06:49 AM
grep multiple text files in folder into 1 text file? coppertone UNIX for Dummies Questions & Answers 7 08-23-2002 11:50 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-24-2005
Registered User
 

Join Date: Sep 2005
Location: Portugal
Posts: 20
Stumble this Post!
help with text

Hi,
does anyone knows how can I do this with commands like sed or tr?
Input File:
this
is
the
text
Output file
t h i s
i s
t h e
t e x t

Thanks!!!!
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-24-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,002
Stumble this Post!
something to start with:
sed 's/./ & /g;s/^ //;s/ $//' file

Last edited by vgersh99; 10-24-2005 at 03:16 PM. Reason: a bit more robust
Reply With Quote
  #3 (permalink)  
Old 10-25-2005
Registered User
 

Join Date: Jul 2005
Posts: 137
Stumble this Post!
Code:
ruby -ne'print split("")*" "' file
Reply With Quote
  #4 (permalink)  
Old 10-25-2005
Registered User
 

Join Date: Jul 2005
Location: England
Posts: 183
Stumble this Post!
Or in perl

Code:
perl -ne '$a=join(" ",split(//)); print $a;' file
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:19 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0