LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-21-2002, 02:37 AM   #1
Barbarian
Member
 
Registered: Nov 2001
Location: Malaysia and Manchester
Distribution: Red Hat
Posts: 46

Rep: Reputation: 15
Removing CR/LF's in bash


Is there a nice and easy way of removing (what I assume are) CR/LF's from a `cat` command I redirected to a buffer so I have a list I can parse at my lesuire?

i.e MyList=`cat somefile.txt`
 
Old 02-21-2002, 03:00 AM   #2
Malicious
Member
 
Registered: Jan 2002
Location: Galveston Island
Distribution: suse, redhat
Posts: 208

Rep: Reputation: 30
Try awk instead of cat.

mylist=awk '{printf("%s ",$0);}' somefile.txt

This will output each line followed by a space.
 
Old 02-21-2002, 03:13 AM   #3
Barbarian
Member
 
Registered: Nov 2001
Location: Malaysia and Manchester
Distribution: Red Hat
Posts: 46

Original Poster
Rep: Reputation: 15
Excellent, just the job!! Take the afternoon off
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
$LINENO can't be modified in bash 3.0, while it can be in bash 2.05b Darwish Linux - Software 1 11-07-2005 02:57 PM
Removing from bash command prompt?? anandt4u Linux - Software 3 06-03-2005 10:36 PM
[bash] removing or editing lines in file Erhnam Programming 12 03-15-2005 07:25 AM
Removing files wihtout removing containing Direcotry caps_phisto Linux - General 2 10-07-2004 08:16 AM
why did bash 2.05b install delete /bin/bash & "/bin/sh -> bash"? johnpipe Linux - Software 2 06-06-2004 06:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration