Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-19-2007, 12:46 PM   #1
LQ Newbie
Registered: Feb 2006
Posts: 20

Rep: Reputation: 0
translate from word list in a file

Is it possible to direct sed or tr to use a list of substitutions in a file? I realise that sed can pull a list of commands from a file, I am just trying to make it easier on the end user.

'#MyVarName1' 'Logic.Values.Digital01'
'#MyVarName2' 'System.Stats.Resets.Count'
is a much easier file for the user to edit, instead of ...
easier to read too...
Old 03-20-2007, 08:30 AM   #2
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 735Reputation: 735Reputation: 735Reputation: 735Reputation: 735Reputation: 735Reputation: 735
You can have a script that reads the file and then uses a "for" loop to put each consecutive item into a sed statement.

Even simpler is the -f option in sed, in which it reads its info from a file.

Here is my favorite sed tutorial:


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: OpenSource medical spelling word list released LXer Syndicated Linux News 0 02-22-2007 01:46 PM
The HorizSync key word must followed by a list of numbers or ranges comox *BSD 2 03-14-2005 04:57 AM
help... get single word from file night-blade1 Programming 3 10-12-2004 09:58 AM
file+word problems warney_out Programming 3 09-02-2004 06:32 AM
MS Word file converter? pepelaz Programming 2 12-13-2003 09:37 AM

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

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