|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
ls/grep question
so i can grep some files and find a string like this:
cat file* | grep something however how do i get the file name also? |
|
#2
|
||||
|
||||
|
grep string *php
will get all occurrences of string in all the php files grep -ir string *php will do the same with case-insensitivity and recursion the file names will be provided along with the, er, offending(!) line ![]() christo
__________________
. Spiration channels: Free scripts, programming tutorials and articles Dotcut alerts: Online Press cuttings / news alerts Clearprop: UK microlight school, wiltshire Uk dating: UK safe dating with Topdates About Christo . . |
|
#3
|
||||
|
||||
|
oh and.. I just knocked up this one:
Code:
grep -ir string *php | cut -f1 -d':' | uniq will uniquely list the names of all the php files containing string with case-insensitivity and recursion. christo |
|
#4
|
||||
|
||||
|
thanks man. i also broke down and looked at the man pages for grep and -H works well also.
![]() |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > ls/grep question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|