Sponsored Content
Full Discussion: FIND and GREP syntax
Top Forums UNIX for Beginners Questions & Answers FIND and GREP syntax Post 303043011 by TestKing on Wednesday 15th of January 2020 10:37:27 PM
Old 01-15-2020
FIND and GREP syntax

I have a question to this command

Code:
find . -type f -name ".*txt" -exec grep "text" {}\.

The find command will locate a file name with the extension of txt once per round and find the word "text" in the content of the file or the find command will locate all the file names with the extension of txt and then find the word "text" in the content of the files?

Also what does {}\ represent for grep command?

Moderator's Comments:
Mod Comment Please do wrap your samples in CODE TAGS as per forum rules.

Last edited by RavinderSingh13; 01-16-2020 at 12:06 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help with the syntax using awk+grep

Hi, I need to extract information from a 4 GB file based on the following conditions: 1) Check for the presence of a set of account numbers Each account number is present along with other information within a PAGESTART and PAGEEND. The file looks like this: PAGESTART ACCOUNT NO 123... (6 Replies)
Discussion started by: kthri
6 Replies

2. Shell Programming and Scripting

grep syntax for this...

I wanna grep for a pattern logs 1 2 & 3 within a folder containing 100 logs grep "test" /folder/log1 /folder/log2 /folder/log3 The above command will work fine but is there any command like grep "test" /folder/log1, log2, log3 or something similar (4 Replies)
Discussion started by: roshanjain2
4 Replies

3. Shell Programming and Scripting

Can I know find syntax to find given date files

Hi All, Can i use find command to know given date files? If yes, then please let me know the syntax for the same. Thanks in advance for your postive responses Regards, Bachegowda (3 Replies)
Discussion started by: bache_gowda
3 Replies

4. BSD

proper syntax of grep command

I'm learning UNIX on my mac (BSD), using a manual. I'm trying to figure out the grep command, and am getting something wrong. I've opened one of my files in NeoOffice and am looking for a string, the phrase 'I am writing.' I've been to some sites to get the proper syntax, and from what I can see... (5 Replies)
Discussion started by: Straitsfan
5 Replies

5. UNIX for Dummies Questions & Answers

| help | unix | grep (GNU grep) 2.5.1 | advanced regex syntax

Hello, I'm working on unix with grep (GNU grep) 2.5.1. I'm going through some of the newer regex syntax using Regular Expression Reference - Advanced Syntax a guide. ls -aLl /bin | grep "\(x\)" Which works, just highlights 'x' where ever, when ever. I'm trying to to get (?:) to work but... (4 Replies)
Discussion started by: MykC
4 Replies

6. Shell Programming and Scripting

Perl Grep Error - Possible Syntax?

Alrighty, I'm trying to get a perl script going to search through a bunch of files for me and compile it to a single location. I am currently having troubles on just getting the grep to work. Here is what I currently have: #!/usr/bin/perl open (LOG, "errors.txt") or die ("Unable to open... (2 Replies)
Discussion started by: adelsin
2 Replies

7. Shell Programming and Scripting

find syntax

i'm trying to find out how to find in my directory and subdirectories a certain file. once i find that file, i need to select that folder and copy it the location or output it to a new text file. i know how to find the file by using find . -name \*.pl | sort -n but idk how to select... (9 Replies)
Discussion started by: kpddong
9 Replies

8. UNIX for Dummies Questions & Answers

Find/Grep Syntax Question

Hi Folks, I am trying to dig through about 100 directories that have 1 or 2 .jpg images stored in each. I want to copy the .jpg to another file in the root directory. Really my ultimate goal is not to have to dig down into each directory to copy the images individually. I thought I could use a... (2 Replies)
Discussion started by: alpinescott
2 Replies

9. Shell Programming and Scripting

Grep syntax print after certain character

My current code is: user@ubuntu:~/Desktop$ grep -e "\(packaged by\)\|\(employee\)\|\(file name\)\|\(Total Data (MB) Read\)\|\(Begin Time\)" log.txt packaged by = Ron Mexico employee = Michael Vick file name = Mike_Vick_2011.bat Total Data (MB) Read: 11.82 Begin Time: 6/13/2011... (8 Replies)
Discussion started by: chipperuga
8 Replies

10. Shell Programming and Scripting

Help on grep syntax in UNIX

Dear Team /app/Appln/logs/ echo Session used server are 'grep -i pid|grep -i session | cut -d'.' -f1 | awk '{print $9}' | sort | uniq' Output - lxserver01 lxserver02 lxserver03 When I grep session pid in logs server details I can see above distinct server details but I... (6 Replies)
Discussion started by: skp
6 Replies
PBCOPY(1)						      General Commands Manual							 PBCOPY(1)

NAME
pbcopy, pbpaste - provide copying and pasting to the pasteboard (the Clipboard) from command line SYNOPSIS
pbcopy [-help] [-pboard {general | ruler | find | font}] pbpaste [-help] [-pboard {general | ruler | find | font}] [-Prefer {txt | rtf | ps}] DESCRIPTION
pbcopy takes the standard input and places it in the specified pasteboard. If no pasteboard is specified, the general pasteboard will be used by default. The input is placed in the pasteboard as plain text data unless it begins with the Encapsulated PostScript (EPS) file header or the Rich Text Format (RTF) file header, in which case it is placed in the pasteboard as one of those data types. pbpaste removes the data from the pasteboard and writes it to the standard output. It normally looks first for plain text data in the pasteboard and writes that to the standard output; if no plain text data is in the pasteboard it looks for Encapsulated PostScript; if no EPS is present it looks for Rich Text. If none of those types is present in the pasteboard, pbpaste produces no output. * Encoding: pbcopy and pbpaste use locale environment variables to determine the encoding to be used for input and output. For example, absent other locale settings, setting the environment variable LANG=en_US.UTF-8 will cause pbcopy and pbpaste to use UTF-8 for input and output. If an encoding cannot be determined from the locale, the standard C encoding will be used. Use of UTF-8 is recommended. Note that by default the Terminal application uses the UTF-8 encoding and automatically sets the appropriate locale environment variable. OPTIONS
-pboard {general | ruler | find | font} specifies which pasteboard to copy to or paste from. If no pasteboard is given, the general pasteboard will be used by default. -Prefer {txt | rtf | ps} tells pbpaste what type of data to look for in the pasteboard first. As stated above, pbpaste normally looks first for plain text data; however, by specifying -Prefer ps you can tell pbpaste to look first for Encapsulated PostScript. If you specify -Prefer rtf, pbpaste looks first for Rich Text format. In any case, pbpaste looks for the other formats if the preferred one is not found. The txt option replaces the deprecated ascii option, which continues to function as before. Both indicate a preference for plain text. SEE ALSO
ADC Reference Library: Cocoa > Interapplication Communication > Copying and Pasting Carbon > Interapplication Communication > Pasteboard Manager Programming Guide Carbon > Interapplication Communication > Pasteboard Manager Reference BUGS
There is no way to tell pbpaste to get only a specified data type. Apple Computer, Inc. January 12, 2005 PBCOPY(1)
All times are GMT -4. The time now is 08:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy