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
CRLF during SFTP transfer is appearing only in one server panchpan AIX 7 11-02-2008 08:31 PM
how to add CRLF support for CSV file generated in unix amitpansuria High Level Programming 3 04-07-2008 02:18 PM
Add CRLF is probably simple! Skyybugg Shell Programming and Scripting 1 04-05-2007 12:34 PM
unix pipe in C meh High Level Programming 1 10-16-2006 08:34 PM
UNIX Pipe akrathi UNIX for Dummies Questions & Answers 5 10-12-2005 05:23 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-21-2009
sfedak sfedak is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 7
Question Converting hex value 7C (for pipe) to CRLF in Unix

I am trying to convert a txt file that includes one long string of data. The lines are separated with hex value 7C (for pipe).

I am trying to process this file using SQR (Peoplesoft) so I thought the easiest thing to do would be to replace the eol char with a CRLF in unix so I can just process as a regular text file in sqr.

The command I am using below replaces EVERY 7 with a ^M and EVERY C with a line feed. What I need, is to replace '7C' with newline or CRLF.

tr '7C' '\r\n' < orig.txt > new.txt

I also tried using sed
sed "s/7C/\n/g" orig.txt > new.txt

but it would only replace 7C with an 'n' and not the line feed that I needed. I have looked at the other threads posted and tried just about all of the suggestions......still no luck so far.

Using tr, can I make the 7C LOOK LIKE 1 character somehow instead of 2? If I could, I would just use the new line (\n) to replace it with.

I would really appreciate your help :-)

Thanks,
Sharon

Last edited by sfedak; 01-21-2009 at 02:52 PM..
 

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:19 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