LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-25-2004, 08:05 PM   #1
Half_Elf
LQ Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 46
Sed, bash scripts, etc...


Ok, I'm far from being a newbie about bash script and such things but I have a strange script to do at work... now the funny part is that we are running on RedHat 6.1 with a very very old kernel (2.2.10?) and very old apps (bash 1.1? WTF!)
(Please don't say anything about updating and such, my boss doesn't want update, I can't do much!!!)

Whatever, I need to replace all "|" in a certain variable with empty space (the variable contains the first line of /proc/net/dev, if you want to know). All this could be very easy to do with any recent version of BASH, but on THAT system (sigh), well... I suppose I should use "sed" or something like this but I can't find the way to place all these damn / and \... I mean, it works with 2 files but I can't find the way to do it with 2 variables.
Any idea, someone, hmmmmm? Any idea is welcome, if you can think of a (very old) apps that can do the job, go ahead, but please note I can't use perl or such language (I can't install anything on the box).

Last edited by Half_Elf; 03-25-2004 at 08:07 PM.
 
Old 03-25-2004, 08:14 PM   #2
stupid_guy
Member
 
Registered: Jun 2003
Distribution: mandrake 9.2
Posts: 57

Rep: Reputation: 15
quote: "I need to replace all "|" in a certain variable with empty space "

hmmm... I know a simple sed substitution that may work:

sed 's/\|/\<space>/g' <filename>
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash, using variable in sed fur Programming 3 11-12-2005 07:41 AM
sed with bash variables MurrayL Linux - Software 2 03-21-2005 08:13 AM
bash - sed/tr??? pk21 Programming 2 09-05-2003 07:56 AM
bash - sed question pk21 Programming 2 08-30-2003 05:57 AM
bash - sed pk21 Programming 6 03-07-2003 11:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:18 AM.

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