Search Results

Search: Posts Made By: OmarKN
1,718
Posted By Don Cragun
It removes .rtf from the end of the name. ...
It removes .rtf from the end of the name.

And, whether or not your pathnames might contain space or tab characters, you should always write your code to allow for that possibility:
find . -type f...
1,718
Posted By Corona688
Remember two important things. First, that *...
Remember two important things. First, that * does not get passed into programs, the shell handles that before mv even runs. Second, that mv works like mv source [source, source, ...] destination
...
1,718
Posted By CarloM
You could just use a for loop: for filename...
You could just use a for loop:

for filename in $(find . -type f -iname "*.rtf.rtf")
do
mv ${filename} ${filename%.rtf}
done

(If you have filenames with spaces in them or uppercase...
4,828
Posted By rbatte1
Hello OmarKN, If you are looking for strings...
Hello OmarKN,
If you are looking for strings within a file, then have a look at the grep command. It allows you to search within files for expressions or strings. It is often combined with find so...
4,828
Posted By pilnet101
find . -type f -name "*modern*"
find . -type f -name "*modern*"
1,993
Posted By Corona688
You can't just dump text into the shell and...
You can't just dump text into the shell and expect it to assume they are your PATH. If you don't tell it otherwise, it will assume it is a command, and look for a program named...
3,135
Posted By gandolf989
There is an easier solution. What about the...
There is an easier solution. What about the following?
grep -ci word * | grep -v ":0$"
3,135
Posted By Corona688
You shouldn't put your own scripts into the...
You shouldn't put your own scripts into the system paths. Make a /home/myusername/bin, put it there, and add /home/myusername/bin to your PATH.
3,135
Posted By Corona688
Actually no, you can type it into your shell and...
Actually no, you can type it into your shell and have it work too. It's the same thing.
3,135
Posted By xbin
May be something like this: grep -ci word *...
May be something like this:

grep -ci word * | while read line; do
if [ ${line#*:} -gt 0 ]; then
printf "%s\n" "$line"
fi
done
2,695
Posted By alister
That's an unnecessarily inefficient solution....
That's an unnecessarily inefficient solution. There's no need to invoke bash for each file. We can just use grep directly.

Also, the pattern used with -name, *.htm*, can match more than just .htm...
2,695
Posted By Don Cragun
If you install this script in $HOME/bin/no_cgi: ...
If you install this script in $HOME/bin/no_cgi:

#!/bin/bash
if ! grep -q "exec cgi" "$1"
then printf 'No "exec cgi" in %s\n' "$1"
fi

and make it executable:

chmod +x $HOME/bin/no_cgi
...
Showing results 1 to 12 of 12

 
All times are GMT -4. The time now is 09:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy