Search Results

Search: Posts Made By: Loc
2,604
Posted By Loc
I thought it would display the output twice...
I thought it would display the output twice because you used echo twice but it's not the case. This works great. thank you
2,604
Posted By Loc
Assign expression to a variable
This code strips out any []. It works great
echo "127[.]0[.]0[.]1" | tr -d "[]" I would like to do the same thing but with shell scripting. User would enter:
./test 127[.]0[.]0[.]1 Output should...
5,868
Posted By Loc
Grep multiple keywords from a file
I have a script that will search for a keyword in all the log files. It work just fine.


LOG_FILES={ "/Sandbox/logs/*" }
for file in ${LOG_FILES[@]}; do
grep $1 $file
done


...
1,582
Posted By Loc
Display files within a range
My script reads all the log files in a directory, the user would enter a range and the script would only display the files within those range. Here's my code:

#!/bin/bash
...
41,217
Posted By Loc
To re-iterate my original question: I get 2...
To re-iterate my original question:

I get 2 numbers from a user and pass those 2 numbers to a function but it keeps on converting the numbers back to a string, so my function keeps crashing. If I...
41,217
Posted By Loc
Convert a String to a Number
I read in two numbers from a user but the number is a string.
#!/bin/bash
read -p "Enter first number: " num1
read -p "Enter second number: " num2
I know you can use the the "expr" or "bc"...
14,332
Posted By Loc
Compare the system date with date from a text file
I get the date that's inside a text file and assigned it to a variable. When I grep the date from the file, I get this,
Not After : Jul 28 14:09:57 2017 GMT
So I only crop out the date, with this...
4,418
Posted By Loc
Grep from a certificate
I can view the openSSL certifcate with this command
openssl x509 -text -in myCertificate.pem
I just wanted to see when the cert will expire only. The line which I want to read is,
Not After :...
5,797
Posted By Loc
I tried you code, "MadeInGermany" but it doesn't...
I tried you code, "MadeInGermany" but it doesn't work.

Here's the working code. The @ symbol means to go through all the element in the array.


#!/bin/bash
LOG_FILES=(
...
1,399
Posted By Loc
Compress Files in Multiple Directories
I would like to compress the files in multiple directories. For some reason, it only compress the first directory (/Sanbox/logs1) but not the rest of the other directories ("/Sanbox/logs2"...
5,797
Posted By Loc
Thank you Chubler_XL works great. Sorry for being...
Thank you Chubler_XL works great. Sorry for being so vague

The previous code will tar up the files in "logs" directory but what if I want to tar up the files in multiple directories. I tried...
5,797
Posted By Loc
Script to Tar file in a specific Directory
I'm trying to write a Unix script that will go to a specific directory (/tmp/Sanbox/logs) and tar.gz all the log files in that directory and delete the original files that are older than 2 days. So...
Showing results 1 to 12 of 12

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