[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

UNIX Script : Regarding find command

Posted on 2008-11-07
3
Medium Priority
?
286 Views
Last Modified: 2012-05-05
How do I search for specific text in a file in a directory.
Ex: I need to search for a file that contains systeminfo@localhost in /usr/local
0
Comment
Question by:jdenver247
3 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 400 total points
ID: 22906128
try

cd /usr/local
grep 'systeminfo@localhost'

or if you have sub directories, then

find /usr/local -type f | xargs grep 'systeminfo@localhost'
0
 
LVL 14

Assisted Solution

by:Deepak Kosaraju
Deepak Kosaraju earned 400 total points
ID: 22906185
grep -i "systeminfo@localhost" /usr/local/\*
0
 
LVL 1

Assisted Solution

by:lwoodtri
lwoodtri earned 200 total points
ID: 22906363
systeminfo@localhost

grep -R -a1 -b1 systeminfo@locahost /usr/local/*

-a1 -b1 shows the data 1 line above and below the text line begin searched on!

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month19 days, 22 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question