CFD Online Logo CFD Online URL
Home > Forums > Main CFD Forum

egrep command

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   September 14, 2004, 07:11
Default egrep command
Posts: n/a

Does somebody know how to use the command egrep for extracting the needed values from a file (.info file, for example)?



  Reply With Quote

Old   September 14, 2004, 14:07
Default Re: egrep command
Ananda Himansu
Posts: n/a
egrep is an older version of the command. You can get equivalent functionality by using grep -E.

I do not know what kind of values you wish to extract, and what a .info file is.

grep is used to find occurrences of a textual pattern in a file or files. It lists to the standard output each line that contains the pattern. The simplest syntax is

grep 'pattern' filename

where 'pattern' is a textual string or more generally a regular expression that may contain wildcard characters such as '*', and other constraints. Type 'man grep' to find the options available with the grep command.

The usual uses for grep are to check which files a pattern occurs in (grep 'subroutine flux' *.f), or which lines of a large file a pattern occurs in (grep -n 'subroutine' myHugeFile.f). grep -i will cause grep to ignore the case of the letters when determining a match.

grep can be used in conjunction with other unix text processing commands, by piping or by redirecting output to a file. For example,

grep -i 'subroutine' myCFDcode.f | wc -l

will tell you how many lines contain one or more occurrences of the word 'subroutine', not caring for case. However, for more complex text processing needs, you will need tools like 'sed' and 'awk'. For industrial strength text processing, you have to turn to languages like Perl or Python.
  Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM 1.7.1 installation problem on OpenSUSE 11.3 flakid OpenFOAM Installation 16 December 28, 2010 09:48
Installation OF1.5-dev ttdtud OpenFOAM Installation 46 May 5, 2009 02:32
OpenFOAM15 installables are incomplete problem with paraFoam tryingof OpenFOAM Bugs 17 December 7, 2008 05:41
Regarding FoamX running Kindly help out hariya03 OpenFOAM Pre-Processing 0 April 18, 2008 04:26
egrep command Julie Siemens 2 September 14, 2004 17:05

All times are GMT -4. The time now is 11:29.