want to search some content of the file with specific to user

I have some users in one unix system and i want to search some files with specific to user and then i want to find some content inside that file so can u help me how we can implement it?

File location is as below.
/pools/home_unix/cmadireddy/work/models/model/
cmadireddy is user name.
now under above path i want to open one file makefile and want to search one string from that file.
hope you ppl r geting wt i want to tell.

I could not find any post/thread for the same.
:b:
Help me its urgent.
thanks prashant

Hello Prashant,

I can understand that u need to search for something! What is that u exactly want?

A script that searches something? if so, what would be its inputs? what will be the file that u want to search?

Please explain in detail!! :slight_smile:

Hello,

There are predefined path and predefined files under that path.
I want to search some string inside that file and if found then proper msg should be displayed.

and i want to do this process based on user and followed by string based files is same for all the user.

Second things i want to implement it based on switch case or let me know if any other option is fine or not?

hope you are geting wt i want to tell u.

thanks
prashant

Hey,

Here are ur needs.. Correct me if wrong!

1> Get the username
2> Search a string inside some files
3> If found, display message

Now the problem is

  1. Are there multiple files that you would need to search?
  2. What is "that string"???

Yes. Switch case is good! no probs! :slight_smile:

1 Like

Hi..
thanks for the same.

There are only two files makefile and makefile.scpd and i need to search predefined string say rms, ams etc inside that files.

Thanks prashant

---------- Post updated at 08:39 AM ---------- Previous update was at 08:11 AM ----------

:confused:

the below code will take model no and search under that model no a specific word.

echo "Enter model no for searching string inside makefile"
read inputs2
#find /pools/home_unix/sapte/work/models/model/$inputs2 -name "makefile" | xargs grep "attr" \;
#;;

I am getting below error.
./menu1.sh: line 151: syntax error near unexpected token `"Hit <ENTER> to continue:"'
./menu1.sh: line 151: `echo "Hit <ENTER> to continue:"'

Can someone help me?

thanks prashant..

Why is

#find /pools/home_unix/sapte/work/models/model/$inputs2 -name "makefile" | xargs grep "attr" \;
#;;

being commented?? :confused:

because of error i have commented it.

prashant