Помощ за един лесничък скрипт

dark_dreamer

Registered
Извинявам се че пускам тази тема тук не видях другаде удачно място, моля ако някой може да помогне да пише. Здравейте нов съм в програмирането на скриптове и имам нужда от вашата помощ за следния скрипт:

Substitution of text within a file: Now suppose you wanted to find and replace some words in a text file. You could do this manually using find and replace in a text editor. However, you could also write a script to automate the task. Here is an example which replaces 'plus' with '+':

echo "x is 5 plus 6" | sed 's/plus/+/g'
We now use sed instead of grep. In the expression s/plus/+/g, the 's' means substitute the second part (separated by '/') for the first and the 'g' means do this everywhere rather than just on the first occurrence. However it is possible to write this in one line (without error checking) using regular expressions. Below is a template, can you fill in the regular expression?

#!/bin/sh
expr `echo $* | sed ''`
exit 0

Въобще нямам представа как да го напиша този скрипт
 
накратко какво трябва да прави скрипта е като го рънваш в терминала заедно с някакъв текст които съдържа думата plus да замени тази дума с знака +


Например да кажем че програмта се казва neshtosi

$ ./neshtosi x is 5 plus 6 plus 7 plus 8

да изведе на екрана

x is 5 + 6 + 7 + 8



Надявам се някой да може да ми помогне много защото от няколко дни вече нито аз нито някой друг го е написал това.
 

Back
Горе