Все вопросы: [grep]
208 вопросов
Найти хранимые процедуры, на которые нет ссылок в исходном коде
Я пытаюсь очистить устаревшую базу данных, отбросив все процедуры, которые не используются приложением.Используя команду grep, я смог определить, что в исходном коде нет ни одной процедуры.Есть ли способ сделать это для всех процедур сразу? ОБНОВЛЕНИЕ: при использовании -E "proc1 | proc2" выв...
Можете ли вы массово редактировать все файлы, возвращаемые с помощью grep?
Я хочу массово отредактировать тонну файлов, возвращаемых с помощью grep.(Я знаю, мне нужно улучшить sed). Итак, если я это сделаю: grep -rnI 'xg_icon-*' Как передать все эти файлы в vi?
получение подстроки из регулярного выражения
Вот строка текста: SRC = '999' где 999 может быть любыми тремя цифрами. Мне нужна команда grep, которая вернет мне 999. Как мне это сделать?
Есть ли способ использовать команды UNIX GREP в операционной системе WIndows
Мне нужна какая-то команда, например GREP в UNIX для операционной системы WINDOWS. Есть ли способ использовать grep или любую аналогичную команду в Windows?
Как выполнить команду с одним параметром за раз в оболочке * nix?
Некоторые команды, такие как svn log, например, будут принимать только один ввод из командной строки, поэтому я не могу сказать grep 'pattern' | svn log. Он вернет информацию только для первого файла, поэтому мне нужно выполнить svn log для каждого из них.независимо. Я могу сделать это с помощ...
Регулярное выражение для поиска уникальных слов в файлах
Для добавления к уникальным словам префикса "UNIQUE:" внутри файла я пытался использовать команду регулярного выражения Perl, например: perl -e 'undef $/;while($_=<>){s/^(((?!\b\b).)*)\b(\w+)\b(((?!\b\b).)*)$/UNIQUE:/gs;print $_;}' demo В демонстрационном файле, содержащем: wat...
grep командной строки для строки с '$' в ней?
Я пытаюсь найти место объединения двух переменных в каталоге скриптов, но когда я пытаюсь сделать следующее: grep -lire "$DATA_PATH . $AWARDS_YEAR" * Я получаю сообщение об ошибке "неопределенная переменная" ... Я думал, что смогу избежать $ s, используя: grep -lire "\$DATA_PATH . \...
Использование grep с двумя переменными
Я хочу использовать grep с двумя переменными в сценарии оболочки var = match cat list.txt | while read word_from_list; do grep "$word_from_list" "$var" >> words_found.txt done Но grep ожидает получить файл в качестве второго ввода: grep: match: нет такого файла или каталога ...
запуск grep из GNU make
Мне нужно найти текст 'ifeq ($ (Param1)' с помощью grep. Я пытаюсь назначить результат поиска переменной make. Проблема в том, что одинарные кавычки не экранируют текст в make поэтому, когда я пытаюсь: GrepResult:= $(shell grep 'ifeq ($$(Param1)' TextFile) Я получаю: Makefile:214: **...
grep множественное расширение текущих и подпапок
Я пытаюсь найти несколько расширений в текущей и во всех подпапках. grep -i -r -n 'hello' somepath/*.{php,html} Это только поиск текущей папки, но не подпапок. Как лучше всего это сделать?
Используете grep и ls в FTP-клиенте?
Как мне использовать grep и ls в FTP-клиенте ... То есть, если я хочу найти какой-то конкретный файл, который я мог бы использовать: ls -l | grep pattern
Преобразование большого текстового файла в однострочные строки (через BASH)
Файл1: hello - dictionary definitions: hi hello hallo greetings salutations no more hello for you - world - dictionary definitions: universe everything the globe the biggest tree planet cess pool of organic life - Мне нужно отформатировать это (для огромного списка слов) в формат термина ...
Удаление множества строк в текстовом файле
Я пытался реализовать сценарий bash, который читает из онлайн-базы данных wordnet, и мне было интересно, есть ли способ удалить различные текстовые файлы с помощью одной команды. Пример FileDump: **** Noun **** (n)hello, hullo, hi, howdy, how-do-you-do (an expression of greeting) "every mo...
Отображение и конвейерная передача только определенной строки текста из потока
Вот сценарий командной строки для поиска словаря с помощью Wordnet: #!/bin/bash # Command line look up using Wordnet - command line dictionary echo "Type in your word:" read word /usr/bin/curl -s -A 'Mozilla/4.0' 'http://wordnetweb.princeton.edu/perl/webwn?s='$word'&sub=Search+WordNet&...
Заключите все строки в текстовом файле в кавычки ('что-то')
У меня есть список каталогов, содержащих пробелы. Мне нужно окружить их символом "", чтобы убедиться, что мои пакетные скрипты будут работать. Как можно заключать каждую новую строку в "и" (кавычки). например Файл1: /home/user/some type of file with spaces /home/user/another type ...
Перечислить все файлы в каталоге с абсолютными путями (исключая каталоги)
У меня сейчас есть: ls -1 $(pwd)/* Предоставляет мне все файлы в каталоге с абсолютными путями, но форматирует его с каталогом в начале каждого списка файлов. Есть ли способ просто рекурсивно получить список файлов в каталоге (абсолютные пути) - исключая сами каталог / подкаталоги?
Удалить пустые строки в текстовом файле с помощью grep
FILE: hello world foo bar Как мне удалить все пустые новые строки в этом FILE? Вывод команды: FILE: hello world foo bar
How to find and replace all occurrences of a string recursively in a directory tree?
Using just grep and sed, how do I replace all occurrences of: a.example.com with b.example.com within a text file under the /home/user/ directory tree recursively finding and replacing all occurrences in all files in sub-directories as well.
matching a line with a literal asterisk "*" in grep
Tried $ echo "$STRING" | egrep "(\*)" and also $ echo "$STRING" | egrep '(\*)' and countless other variations. I just want to match a line that contains a literal asterisk anywhere in the line.
Can grep show only words that match search pattern?
Is there a way to make grep output "words" from files that match the search expression? If I want to find all the instances of, say, "th" in a number of files, I can do: grep "th" * but the output will be something like (bold is by me); some-text-file : the cat sat on the mat some-other-t...
grep utility in shell script
I'm trying to overcome a limitation on our file structure. I want to grep a whole series of files in a known location. If I do a standard grep from command line (grep -i searchpattern known_dir/s*.sql) I get the following error: ksh: /usr/bin/grep: 0403-027 The parameter list is too long....
How can grep interpret literally a string that contains an asterisk and is fed to grep through a variable?
I have this script: #!/bin/bash CLASSPATH="/blah/libs/*:/blah/more/libs" CMD="java -cp $CLASSPATH MainClass" ALREADY_RUNNING_PID=`ps -ef --no-headers | grep $CMD | grep -v grep | awk '{print $2}'` if [ "$ALREADY_RUNNING_PID" ]; then echo "Already running" exit 1 fi $CMD & probl...
Printing out names of only directories and not files (BASH)
I have most of what I need so far I'm just unsure of the grep command to get only directories or if there isn't one. For context, this is the original request: This script should take a single command line argument which will be a path to a directory. (done) The script should make sure that the...
grep - search for "\n" at start of a file
I have a hunch that I should probably be using ack or egrep instead, but what should I use to basically look for <? at the start of a file? I'm trying to find all files that contain the php short open tag since I migrated a bunch of legacy scripts to a relatively new server with the latest ...
Problem with regular expression using grep
I've got some textfiles that hold names, phone numbers and region codes. One combination per line. The syntax is always "Name Region_code number" With any number of spaces between the 3 variables. What I want to do is search for specific region codes, like 23 or 493, forexample. The problem is ...
map string position to line number in regex output
I'm working on a "grep-like" utility in Python for searching Oracle source code files. Coding standards have changed over time, so trying to find something like "all deletes from table a.foo" could span multiple lines, or not, depending on the age of that piece of code: s = """-- multiline DDL ...
Grep with "half"-exact match
I try to use grep to match a case like this: I have a list of hostname and ips in this format: 238-456 192.168.1.1 ak238-456 192.168.1.2 238-456a 192.168.1.3 458-862 192.168.1.4 Now i try to grep "238-456" but of course this returns: 238-456 192.168.1.1 and... ak238-456 192.168.1.2 and....
grep egrep multiple-strings
Suppose I have several strings: str1 and str2 and str3. How to find lines that have all the strings? How to find lines that can have any of them? And how to find lines that have str1 and either of str2 and str3 [but not both?]?
calling grep from a bash script
I'm new to bash scripts (and the *nix shell altogether) but I'm trying to write this script to make grepping a codebase easier. I have written this #!/bin/bash args=("[email protected]"); for arg in args grep arg * */* */*/* */*/*/* */*/*/*/*; done when I try to run it, this is what happens: ~/Work/richmo...
How can I collapse this bash command line into an awk statement?
I've created an awk script and use it like this: # grep -E "[PM][IP][DO][:S]" file.txt | awk-script How can I modify the awk script to include the effort of the grep command (which is searching for either "PID:" or "MPOS"? awk-script is: #!/usr/bin/awk -f /Sleeve/ { printf("%8d, %7d...