The user will input the word or phrase .... I want to search the user input in file (by lines) but not all then with this line search on another file ( with the specific line) and show to the user.
Example:
file1.txt
=======
a
aa
aaa
aab
aac
file2.txt (corresponding md5 hashes of every text line)
======
0cc175b9c0f1b6a831c399e269772661
4124bc0a9335c27f086f24ba207a4912
47bce5c74f589f4867dbd57e9ca9f808
e62595ee98b585153dac87ce1ab69c3c
a9ced3dad556814ed46042de696e1849
========
Lets supposed to the user enter (want to crack) this hash: a9ced3dad556814ed46042de696e1849
Hi, i've got the following:
a=`echo $b | grep '^.*/'`
i'm storing in the variable the value of the variable b only if it has a / somewhere.
It works, but i don't want to print the value. How do i give the value of b to the grep command without the echo?
thanks! (5 Replies)
I am performing a grep command and I need to know how to echo "NONE" or "0" to my file if grep does not find what i am looking for.
echo What i found >> My_File
grep "SOMETHING" >> My_File
I am sure this is easy, I am sort of new at this!
Thanks (2 Replies)
Hi,
I am cutting data from a fixed length test file and then writing out a new record using the echo command, the problem I have is how to stop multiple spaces from being written to the output file as a single space.
Example:
cat filea | while read line
do
field1=`echo $line | cut -c1-2`
... (6 Replies)
Hello,
well what I'm trying to do is to remove underscores from filenames and leaving empty spaces instead:
arturas@Universe:/windows/Center/training$ ls
big_file failas su shudu
arturas@Universe:/windows/Center/training$ a=big_file
arturas@Universe:/windows/Center/training$ mv $a `echo... (8 Replies)
Is there any way in a script to print out the commands being ran? In DOS script, there is the "@echo on" and "@echo off".
so I have a script like this:
#!/bin/ksh
echo "hello there. moving files."
<turn on echoing here>
cp thisfile.txt thatfile.txt
cp whatfile.prop whyfile.prop
<turn... (2 Replies)
My current line command is as follows:
echo -n "text: " ; grep "blah text" ../dir1/filename | wc -l
The output to the screen is as needed, but how do I print to a text file? (9 Replies)
Is there an environment issue that would not allow the following not store and pass the value into this field:
underScorePresent=`echo $USER | grep "_" | wc -l`
It is running on a new redhat 6.5 OS. The value $USER is set to cpac. It is a vendor code and they are saying it is environment... (1 Reply)
version info : Fedora 28 (Kernel version: 4.16.12-300)
shell : bash
Using echo command , if I redirect a text like "Chocolate" to a file , all the contents in the file are overwritten as shown below.
# cat /tmp/someTest
Hello world
One more Hello world
myLine3
# echo... (4 Replies)
Discussion started by: kraljic
4 Replies
LEARN ABOUT SUNOS
fgrep
fgrep(1) User Commands fgrep(1)NAME
fgrep - search a file for a fixed-character string
SYNOPSIS
/usr/bin/fgrep [-bchilnsvx] [-e pattern_list] [-f pattern-file] [pattern] [file...]
/usr/xpg4/bin/fgrep [-bchilnsvx] [-e pattern_list] [-f pattern-file] [pattern] [file...]
DESCRIPTION
The fgrep (fast grep) utility searches files for a character string and prints all lines that contain that string. fgrep is different from
grep(1) and from egrep(1) because it searches for a string, instead of searching for a pattern that matches an expression. fgrep uses a
fast and compact algorithm.
The characters $, *, [, ^, |, (, ), and are interpreted literally by fgrep, that is, fgrep does not recognize full regular expressions as
does egrep. These characters have special meaning to the shell. Therefore, to be safe, enclose the entire string within single quotes (').
If no files are specified, fgrep assumes standard input. Normally, each line that is found is copied to the standard output. The file name
is printed before each line that is found if there is more than one input file.
OPTIONS
The following options are supported:
-b Precedes each line by the block number on which the line was found. This can be useful in locating block numbers by con-
text. The first block is 0.
-c Prints only a count of the lines that contain the pattern.
-e pattern_list Searches for a string in pattern-list. This is useful when the string begins with a -.
-f pattern-file Takes the list of patterns from pattern-file.
-h Suppresses printing of files when searching multiple files.
-i Ignores upper/lower case distinction during comparisons.
-l Prints the names of files with matching lines once, separated by new-lines. Does not repeat the names of files when the
pattern is found more than once.
-n Precedes each line by its line number in the file. The first line is 1.
-s Works silently, that is, displays nothing except error messages. This is useful for checking the error status.
-v Prints all lines except those that contain the pattern.
-x Prints only lines that are matched entirely.
OPERANDS
The following operands are supported:
file Specifies a path name of a file to be searched for the patterns. If no file operands are specified, the standard input will
be used.
/usr/bin/fgrep
pattern Specifies a pattern to be used during the search for input.
/usr/xpg4/bin/fgrep
pattern Specifies one or more patterns to be used during the search for input. This operand is treated as if it were specified as
-e pattern_list.
USAGE
See largefile(5) for the description of the behavior of fgrep when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes).
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of fgrep: LC_COLLATE, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 If any matches are found
1 If no matches are found
2 For syntax errors or inaccessible files, even if matches were found.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
/usr/bin/fgrep
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
/usr/xpg4/bin/fgrep
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWxcu4 |
+-----------------------------+-----------------------------+
|CSI |Enabled |
+-----------------------------+-----------------------------+
SEE ALSO ed(1), egrep(1), grep(1), sed(1), sh(1), attributes(5), environ(5), largefile(5), XPG4(5)NOTES
Ideally, there should be only one grep command, but there is not a single algorithm that spans a wide enough range of space-time tradeoffs.
Lines are limited only by the size of the available virtual memory.
/usr/xpg4/bin/fgrep
The /usr/xpg4/bin/fgrep utility is identical to /usr/xpg4/bin/grep -F (see grep(1)). Portable applications should use /usr/xpg4/bin/grep
-F.
SunOS 5.10 4 Oct 2002 fgrep(1)