473,400 Members | 2,163 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

Input Redirection

kaarthikeyapreyan
I have a small problem with the input redirection.

to search for a particular pattern in all files i have used this command

Expand|Select|Wrap|Line Numbers
  1. find $dir -type f -print | xargs grep -E -n -w <pattern> | tee my res.txt
this would give me the output in the format

filename : line number : matching line

I would like to have something like this in my output file

filename : line number : matching line : match

the solution that i wondering was that i would redirect my output to another command

Expand|Select|Wrap|Line Numbers
  1. grep -o <pattern>
so my new structure would look like

Expand|Select|Wrap|Line Numbers
  1. find $dir -type f -print | xargs grep -E -n -w <pattern> | tee -a my res.txt | grep -o pattern | tee -a myres.txt
my the output from tee has to be redirected in a correct way which would make this code to work fine.
Oct 26 '09 #1
2 2060
numberwhun
3,509 Expert Mod 2GB
Ok, I will be the first to ask it.... is there a question in all of that that you would like to know the answer to?
Oct 29 '09 #2
Yes there is ...

I would like to have something like this in my output file

filename : line number : matching line : match
the redirection is not proper to get the desired output
so what would be the best wat to use the redirection to get my desired output

so my new structure would look like
Expand|Select|Wrap|Line Numbers
  1. find $dir -type f -print | xargs grep -E -n -w <pattern> | tee -a my res.txt | grep -o pattern | tee -a myres.txt 
Oct 30 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: MadHatter | last post by:
Hello, is there any command line switch or anything else which would allow me to use the standard input as the source for a script? so that I could type perl hit return and type out the script...
3
by: Bill Cohagan | last post by:
I'm writing a console app (in C#) and I want to be able to redirect the standard input/output streams when it's run at a command prompt. IOW I want to support the "<" and ">" redirection syntax....
52
by: Gerard M Foley | last post by:
Can one write a webpage which is not displayed but which simply redirects the user to another page without any action by the user? Sorry if this is simple, but I am sometimes simple myself. ...
6
by: Kobu | last post by:
Do the "larger" input functions like scanf, gets, fgets use fgetc to take input or an operating system call function like read() (I know it could be any "way", but I'm trying to find out how it's...
3
by: ES Kim | last post by:
Hi, I am using VC++ .NET 7.0. I'd like to debug my console program, using redirection of input/output for convenience. Help menu tells me it's possible to specify a file name as a command-line...
4
by: Marc Jennings | last post by:
Hi all, I want to run an external app from an assembly. Simple enough... > Process ExtProcess = new Process(); > ExtProcess.StartInfo.FileName = myAppName; > ExtProcess.StartInfo.Arguments =...
17
by: comp.lang.tcl | last post by:
The TCL command I am using will do a command-line action on a PHP script: set cannotRunPHP I have to do it this way as both the TCL script and the PHP script run as CLI. However, "info.php"...
1
by: comp.lang.php | last post by:
require_once("/users/ppowell/web/php_global_vars.php"); if ($_GET) { // INITIALIZE VARS $fileID = @fopen("$userPath/xml/redirect.xml", 'r'); $stuff = @fread($fileID,...
0
by: Fredrik Lundh | last post by:
David Bikard wrote: Was that supposed to be prog_name.py <input_file >output_file ? (< and does i/o redirection; random google link: http://www.ss64.com/ntsyntax/redirection.html
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.