10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear Ladies & Gents,
I have a requirement to delete all the log files in /var/log/test directory that are older than 10 days and their first line begin with "MSH" or "<?xml" or "FHS". I've put together the following BASH script, but it's erroring out:
for filename in $(find /var/log/test... (2 Replies)
Discussion started by: Hiroshi
2 Replies
2. Shell Programming and Scripting
Hi ! :)
I noticed that I create often of temporary files to keep character strings or other and I wish to avoid that if possible ? e.g :
#!/bin/bash
CONFIG_FILE="conf.cfg"
TEMP_HOSTNAME="temp_file1.txt"
for IP in `egrep -o '({1,3}\.){3}{1,3}' $CONFIG_FILE`
do
ssh "$IP"... (2 Replies)
Discussion started by: Arnaudh78
2 Replies
3. Shell Programming and Scripting
Hello.
Following recommendations for one of my threads, this is working perfectly :
#!/bin/bash
CNT=$( grep -c -e "some text 1" -e "some text 2" -e "some text 3" "/tmp/log_file.txt" )
Now I need a grep success for some thing like :
#!/bin/bash
CNT=$( grep -c -e "some text_1... (4 Replies)
Discussion started by: jcdole
4 Replies
4. Shell Programming and Scripting
Hi Experts.
I'm stuck with the below AWK code where i'm trying to move the records containing any special characters in the last field to a bad file.
awk -F, '{if ($NF ~ /^|^/) print >"goodfile";else print >"badfile"}' filename
sample data
1,abc,def,1234,A *
2,bed,dec,342,* A ... (6 Replies)
Discussion started by: shell_boy23
6 Replies
5. Shell Programming and Scripting
I came across and unexpected behavior with redirections in tcsh. I know, csh is not best for redirections, but I'd like to understand what is happening here.
I have following script (called out_to_streams.csh):
#!/bin/tcsh -f
echo Redirected to STDOUT > /dev/stdout
echo Redirected to... (2 Replies)
Discussion started by: marcink
2 Replies
6. Shell Programming and Scripting
logs:
"/home/abc/public_html/index.php"
"/home/abc/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
how to use "cut" or "awk" or "sed" to get the following result:
abc
abc
xyz
xyz
xyz (8 Replies)
Discussion started by: timmywong
8 Replies
7. Shell Programming and Scripting
Hello everyone
Sorry I have to add another sed question. I am searching a log file and need only the first 2 occurances of text which comes after (note the space) "string " and before a ",". I have tried
sed -n 's/.*string \(*\),.*/\1/p' filewith some, but limited success. This gives out all... (10 Replies)
Discussion started by: haggismn
10 Replies
8. Shell Programming and Scripting
Hi everyone,
Looking for a suggestion to improve the below script in which I´ve been working.
The thing is I have 3 separated AWK scripts that I need to apply over the inputfile, and for scripts (2) and (3) I have to use a "temp" file as their inputfile (inputfile_temp and inputfile_temp1... (2 Replies)
Discussion started by: cgkmal
2 Replies
9. Shell Programming and Scripting
input string="3MMTQSZ348GGMZRQWMJM4SD6M"
output string="3MMTQ-SZ348-GGMZR-QWMJM-4SD6M"
using linux shell script (4 Replies)
Discussion started by: pankajd
4 Replies
10. AIX
Hi All,
Can't find any documentation on the web for this anywhere, except about three web pages that are in Chinese.
When I enter SMIT on this box, I get
ERROR MESSAGE: Unable to open temp file
I suspected smit.log, but it is universal readable, writeable by root, and I am root.... (6 Replies)
Discussion started by: jeffpas
6 Replies