I recently had trouble with some regex on the command-line, and
found that for matching a backslash, different numbers of
characters can be used. This number depends on the quoting used for
the regex (none, single quotes, double quotes).
Am trying to grep pattern from dozen files .tar.gz but its very slow
am using
tar -ztf file.tar.gz | while read FILENAME
do
if tar -zxf file.tar.gz "$FILENAME" -O | grep "string" > /dev/null
then
echo "$FILENAME contains string"
fi
done
I got a problem to read standard input file, to edit the standard input, and to write the output to other file.
I am running a query against a database and spooling it to a file.
I need to check to see if a certain value is in a specific field.
I can use awk to check the specific field.
However, part of the value changes.
I know i'm asking a lot of questions, but im just starting to learn this and it is very different that c
so heres my new question
im writing a script that changes file extension and or ending of files with not extensions. I have the code working to change the extension, but i'm trying to tell the user when they enter an extension that does not exist so they know there was an error in input.
Hello,
Currently I have:
Code:
FILE=/home/file.txt
if [ -f $FILE ];
then
echo "File $FILE exists"
else
echo "File $FILE does not exist"
fi
exit
I would like to make it such that if the file *does* exist, it performs a wc -l count of the file and then if the count is greater than 3 performs some command....how do I integrate the second if comma
Hello,
I am not sure, where I am missing in the scirpt, I am trying to grep few users from /etc/passwd file and if exists, I added line to echo as user exist, if not create it.
Code:
#!/bin/bash
for vid in v707 z307 z496 z163 z292 ; do
if [ grep "$vid" /etc/passwd ]
then
echo " $vid User exists "
else
Hi,
I am using the grep function to grep some lines from a text file. However, a line is grepped only once even if it matches the strings in the first file more than once. How can i change the code so that the line gets printed more than once?
Input file 1:
Code:
1 o p
1 a b
2 3 c
5 6 7
Input file 2:
Code:
o a c
Desired Output:
Code:
1 o p
1 a b
2 3 c
Thanks!
Hi there
please have a look at the code..i want to create Using a named pipe.