Find the only string name based on the sub string name in a file. Command used: What works: File content: Output (desired output): What does not work: File content: Output: Need output SomeApi-CURRENT.war Answer It appears, you are interested in the docBase attribute of your xml elements. Specifically those where the value string contains “current” as a substring. But this
Tag: search
How can I recursively search for multiple patterns on linux?
I am trying to find files that include either of the following two patterns: By AND, I mean a logical and. I am using the following command: to check if a file has INTO and SELECT, but this returns the string if either one exists, but I need both. Answer If the patterns have to occur on the same line,
searching a file in linux
I want to find in the system a file, and I know part name of it. How could I do that? I tried unsuccessfully the command: The problem is probably very easy however I cannot find a decent tutorial on searching files in linux. Please tell me what command solves my problem and if you know a good tutorial so
grep first n rows, return file name only
I can do the following to search for what I need and return the file name: grep -l “mysearchstring” ./*.xml However the files I am searching are huge so this takes forever. The string I am searching will appear in the first 200 rows so how can I search only the first 200 rows and still return the file name?
Ignore case when trying to match file names using find command in Linux
Right now, all I know to use is: that is case sensitive and it won’t find files named: How can I search so that all the above would be returned in the search to a case-insensitive matching? Answer Or you could use find / | grep -i string