UNIX Scripting help to input string and search a file to find


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX Scripting help to input string and search a file to find
# 1  
Old 08-09-2015
UNIX Scripting help to input string and search a file to find

Hi Don, this is not homework question. I work for a Credit card company and my development goal this year is to learn Unix. I would love if others can help me get started, thanks.

Hi everyone
I am new to Unix and need help writing a script that can ask user for an input, then search that input within a file

I know will have to use the read and grep commands, anyone can give me somewhere to start would help

Task: Write a script to display which volume pool a given tape belongs. This script should use as input a file that contains a list of tape barcodes.

thanks,


Richard
# 2  
Old 08-09-2015
OK. The homework violation infraction has been reversed (and you weren't given an infraction for double posting). The other two duplicates of this thread remain closed.

Which UNIX operating system are you using?

What shell are you using?

What is the pathname of the file that contains your list of tape barcodes?

What is the format of the file that contains your list of tape barcodes?

Please show us a sample of the contents of the file that contains your list of tape barcodes (in CODE tags), a sample of the input a user is expected to enter into your script, and the output you are trying to produce corresponding to the sample file contents and user input you will provide (in CODE tags).

Are you just extracting data from your list of tape barcodes, or are you changing something in that file to indicate that the selected tape is now in use?
# 3  
Old 08-09-2015
Quote:
Originally Posted by 12ic11
my development goal this year is to learn Unix. I would love if others can help me get started, thanks.
I suggest you get a book about shell programming (my suggestion, as always, is Barry Rosenbergs "Hands-On KornShell93 Programming"). It will not work to try and teach you this over the internet because this is beyond the scope of this forum.

For the same reason i think the solution to your mentioned problem will in no way help you. If you want to learn shell scripting you should do it yourself (otherwise there will be no learning effect) and if you just need examples for scripting: the internet is full of them and you surely can google yourself, no?

I hope this helps.

bakunin
These 2 Users Gave Thanks to bakunin For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Search partial string in a file and replace the string - UNIX

I have the below string which i need to compare with a file and replace this string in the file which matches closely. Can anyone help me on this. string(Scenario 1)- user::r--,user::ourfrd:r-- String(Scenario 2)- user::r-- File **** # file: /local/Desktop/myfile # owner: me # group:... (6 Replies)
Discussion started by: sarathy_a35
6 Replies

2. Shell Programming and Scripting

How can I use find command to search string/pattern in a file recursively?

Hi, How can I use find command to search string/pattern in a file recursively? What I tried: find . -type f -exec cat {} | grep "make" \; Output: grep: find: ;: No such file or directory missing argument to `-exec' And this: find . -type f -exec cat {} \; -exec grep "make" {} \;... (12 Replies)
Discussion started by: cola
12 Replies

3. Shell Programming and Scripting

UNIX Scripting help to input string and search a file to find

Hi everyone, I am new to Unix and need help writing a script that can ask user for an input, then search that input within a file I know will have to use the read and grep commands, anyone can give me somewhere to start would help Task: Write a script to display which volume pool a given... (1 Reply)
Discussion started by: 12ic11
1 Replies

4. UNIX for Dummies Questions & Answers

UNIX Scripting help to input string and search a file to find

Hi everyone, I am new to Unix and need help writing a script that can ask user for an input, then search that input within a file I know will have to use the read and grep commands, anyone can give me somewhere to start would help Task: Write a script to display... (1 Reply)
Discussion started by: 12ic11
1 Replies

5. Shell Programming and Scripting

How to search and append words in the same file using unix scripting file operations

Hi , I have a file myhost.txt which contains below, 127.0.0.1 localhost 1.17.1.5 atrpx958 11.17.10.11 atrpx958zone nsybhost I need to append words only after "atrpx958" like 'myhost' and 'libhost' and not after atrpx958zone. How to search the word atrpx958(which is hostname) only,... (5 Replies)
Discussion started by: gsreeni
5 Replies

6. Shell Programming and Scripting

generate tabular output from an input text file in unix shell scripting

Hi, I have the output (as below) which i want it to be in a table. For e.g. space utilization in PSE on path /logs is 0% space utilization in PSE on path /logs/tuxedo/tuxlsp is 16% space utilization in PSE on path /ldvarlsp/lsp/log is 37% space utilization in PSE on path /home is 6%... (7 Replies)
Discussion started by: pkbond
7 Replies

7. Shell Programming and Scripting

Search and find the string and output to a new file.

Hi I want to search the following in the entire file and put them in a diff file. file 1 contains : Non error probabilities are not decreasing in curve 1GEORGE_SGD_SUB Mid Point RESCAP_SGD_SNU curve have errors Non default probabilities are not decreasing in curve ABF_JPY_SUB Mid Point... (3 Replies)
Discussion started by: szchmaltz
3 Replies

8. UNIX for Dummies Questions & Answers

Unix Shell Scripting -- update employees not present in input file

ALL, My shell script takes a employee file as input. I have to identify the list of employees not in the input file and update their status in the database. Approach I followed: by traversing through the input file add all the emplid's to a variable. update the status of employees not in... (2 Replies)
Discussion started by: sailussr
2 Replies

9. UNIX for Dummies Questions & Answers

Loop till you find a string in a fine <-- Need Help New to Unix Scripting

Guys - I am new to Unix scripting and am in need for a script that does the following. I have bits and pieces created and tested but i am just having a little difficult time getting it all together. - Loop through till it finds a string in a specific file. Any help is greatly appreciated. ... (1 Reply)
Discussion started by: mrehman
1 Replies

10. UNIX for Dummies Questions & Answers

Unix find command to print directory and search string

Hi i need to print pathname in which the string present using 'find' command sample output like this Pathname String to be searched ---------- -------------------- /usr/test/myfile get /opt/test/somefile get Thanks in... (4 Replies)
Discussion started by: princein
4 Replies
Login or Register to Ask a Question