Shell script to find out words, replace them and count words


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script to find out words, replace them and count words
# 1  
Old 12-04-2010
Shell script to find out words, replace them and count words

hello,

i 'd like your help about a bash script which:
1. finds inside the html file (it is attached with my post) the code number of the Latest Stable Kernel,
2.finds the link which leads to the download location of the Latest Stable Kernel version,
(the right link should lead to the file linux-x.x.x.tar.bz2)
3. Downloads from the link above the kernel of Linux (with wget)
4. Decompresses the attached directory which contains the code of the kernel
5. The script then searches in each file in the directory to find the word "Linus" and will replace with a string given by the user.
6. For every replace it will print in a file, a row which has three rows:
i. the name of the file in which the word "Linus" was found,
ii. the number of the line in which the word was found,
iii. the container of the line after the replacement.

every possible help will be very appreciated. Thank you.
# 2  
Old 12-04-2010
What have you tried so far ?
# 3  
Old 12-05-2010
Basically not much. It is my first assignment on shell programming, and it seems like I am a bit lost in the online tutorials. Anything on this is helpful.. Thank you
# 4  
Old 12-05-2010
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace particular words in file based on if finds another words in that line

Hi All, I need one help to replace particular words in file based on if finds another words in that file . i.e. my self is peter@king. i am staying at north sydney. we all are peter@king. How to replace peter to sham if it finds @king in any line of that file. Please help me... (8 Replies)
Discussion started by: Rajib Podder
8 Replies

2. Shell Programming and Scripting

sed Find and Replace Text Between Two Strings or Words

I am looking for a sed in which I can recognize all of the text in between two indicators and then replace it with a place holder. For instance, the 1st indicator is a list of words "no|noone|havent" and the 2nd indicator is a list of punctuation ".|,|!".From a sentence such as "noone... (3 Replies)
Discussion started by: owwow14
3 Replies

3. UNIX for Dummies Questions & Answers

Replace the words in the file to the words that user type?

Hello, I would like to change my setting in a file to the setting that user input. For example, by default it is ONBOOT=ON When user key in "YES", it would be ONBOOT=YES -------------- This code only adds in the entire user input, but didn't replace it. How do i go about... (5 Replies)
Discussion started by: malfolozy
5 Replies

4. Shell Programming and Scripting

Gawk gensub, match capital words and lowercase words

Hi I have strings like these : Vengeance mitt Men Vengeance gloves Women Quatro Windstopper Etip gloves Quatro Windstopper Etip gloves Girls Thermobite hooded jacket Thermobite Triclimate snow jacket Boys Thermobite Triclimate snow jacket and I would like to get the lower case words at... (2 Replies)
Discussion started by: louisJ
2 Replies

5. Shell Programming and Scripting

How count the number of two words associated with the two words occurring in the file?

Hi , I need to count the number of errors associated with the two words occurring in the file. It's about counting the occurrences of the word "error" for where is the word "index.js". As such the command should look like. Please kindly help. I was trying: grep "error" log.txt | wc -l (1 Reply)
Discussion started by: jmarx
1 Replies

6. Shell Programming and Scripting

shell script to print words having first and last character same.

Hi I want to write a shell script to print only those words from a file whose beginning and last character are same. Please help. Thanks, vini (5 Replies)
Discussion started by: vini kumar
5 Replies

7. Shell Programming and Scripting

Count words

Hi, does anyone know the command to count words by its length. I need to Count the number of five letter words that I have in a file with thousand of words. thanks (3 Replies)
Discussion started by: fabioamaury
3 Replies

8. Shell Programming and Scripting

Perl Script to find & copy words from Web.

I need to write a perl script to search for a specific set of numbers that occur after a series of words but before another. Specifically, I need to locate the phrase today at the summit, then immediately prior to the words tonnes/day copy the number that will be between 100 and 9,999, for example,... (1 Reply)
Discussion started by: libertyforall
1 Replies

9. Shell Programming and Scripting

Need to change two words in a line using shell script.

Hi, i have a line tftp dgram udp wait nobody /usr/sbin/tcpd in.tftpd /tftpboott in /etc/inet.conf file. ineed to replace nobody with root and /tftpboott with /flx/boot. i tried using sed ,but i could not change both of them. can you please help me to do this. Edit:... (7 Replies)
Discussion started by: vprasads
7 Replies

10. Shell Programming and Scripting

Script to find all the files that contain any of the words present in another file

Hi All, I am new to UNIX and shell scripts and also new to this forum. I need a script to find all the files in a directory that contain any of the strings present in another file. Please provide me the script or if you could provide pointers to any link in this forum it would be helpful.... (4 Replies)
Discussion started by: tsanthosh
4 Replies
Login or Register to Ask a Question