Jump to content

Using sed


Jza
 Share

Recommended Posts

Hi I would like to know how to use sed and cron. I know this are both very basic tools but maybe because they are I havent been able to find a coherent tutorial that works with this. i am looking to do the following:

- Sed;

- search and replace

- insert a break line every number of characters

 

- cron

- set a cronjob

Link to comment
Share on other sites

Hi jza,

 

with sed you could to the following to search&replace:

 

sed -e 's/oldpattern/newpattern/g' file > newfile

 

This would replace all strings matching oldpattern with the string in newpattern in "file", writing the output to "newfile". Patterns follow the rules of perl regular expressions. You can find an introduction to regex here:

 

http://www.anaesthetist.com/mnm/perl/regex.htm

 

For cron, check "man cron", "man crontab" and study the cron related files in /etc. A good explanation of the structure of a crontab file is here:

 

http://en.wikipedia.org/wiki/Crontab

 

If you'd like to have some job done regularly, you can edit one of those files in /etc accordingly.

 

HTH,

 

scoonma

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...