LinuxQuestions.org
Review your favorite Linux distribution.
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 12-15-2005, 04:14 PM   #1
mhamro
LQ Newbie
 
Registered: Aug 2005
Posts: 4

Rep: Reputation: 0
shell script help


I wonder if there is an easy way to script:
1. Create a file from a template by replacing some tags in the template with specified strings.

2. Just copying a block of text from one file into different files. Let's say, I know beginning and the end strings of the text block, I would like to "grab" it and insert it into the other 2-3 files after some specified place (string or tag) or just append to the end of those files.

Let me know if I shouldn't submit these kind of questions here but in another place.


Thanks in advance.
M
 
Old 12-15-2005, 04:36 PM   #2
linux=future
Member
 
Registered: Apr 2005
Distribution: Debian
Posts: 154

Rep: Reputation: 30
This sounds like a lot of editing of text files. Two programs in particular are good for modifying text from a shell script, sed and awk. Both have a bit of a learning curve, but they are powerful. A google of both will give you some information. A trip to each manpage will also be helpful.

Last edited by linux=future; 12-15-2005 at 04:38 PM.
 
Old 12-15-2005, 05:00 PM   #3
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,545

Rep: Reputation: 57
Asking them here should be fine, it generally makes more sense to just ask the question first rather than ask to ask the question. If it's in the wrong place then you'll just piss off a mod cause they'll have to move it

For both of those sed can do everything you want. Google it and scan the man page, it can do heaps of cool schtuff
 
  


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
Shell script inside shell script treotan Linux - General 4 02-19-2009 06:34 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
[SHELL SCRIPT] Write at the right of the shell window Creak Linux - General 2 04-02-2004 03:00 PM

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

All times are GMT -5. The time now is 02:55 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