Sponsored Content
Top Forums Shell Programming and Scripting Grep'ing information from a log file on SUN OS 5 Post 302574678 by hergp on Friday 18th of November 2011 02:52:12 AM
Old 11-18-2011
Try to replace the single quotes with double quotes and add another pair of escaped quotes for the shell on hostname, so that the pipe character is not interpreted by the shell there.
Code:
ssh hostname grep "\"$HOST|$DATE\"" /path/to/file.log

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grep'ing for text within a bunch of files...?

I have, say, a dozen files, and I want to grep for a string of text within them. I don't remember the exact syntax, but let me give it a shot and show you an idea here... find . -type f -exec grep thisword {} \; ...and there's a way to put more than one grep into the statement, so it will tell... (1 Reply)
Discussion started by: kitykity
1 Replies

2. Shell Programming and Scripting

grep'ing and sed'ing chunks in bash... need help on speeding up a log parser.

I have a file that is 20 - 80+ MB in size that is a certain type of log file. It logs one of our processes and this process is multi-threaded. Therefore the log file is kind of a mess. Here's an example: The logfile looks like: "DATE TIME - THREAD ID - Details", and a new file is created... (4 Replies)
Discussion started by: elinenbe
4 Replies

3. Shell Programming and Scripting

grep'ing a file until a certain message appears

Hello, I'm writing a script that will automate the launch of some services on my AIX machine. However, some services are dependent on the successful startup of others. When I start these services manually, I usually just check a log file until I see a message that confirms a successful... (3 Replies)
Discussion started by: pallak7
3 Replies

4. Shell Programming and Scripting

pipe'ing grep output to awk

This script is supposed to find out if tomcat is running or not. #!/bin/sh if netstat -a | grep `grep ${1}: /tomcat/bases | awk -F: '{print $3}'` > /dev/null then echo Tomcat for $1 running else echo Tomcat for $1 NOT running fi the /tomcat/bases is a file that... (2 Replies)
Discussion started by: ziggy25
2 Replies

5. Shell Programming and Scripting

grep'ing a variable that contains a metacharacter ($) with a while loop

This is driving me crazy, and I'm hoping someone can help me out with this. I'm trying to do a simple while loop to go through a log file. I'm pulling out all of the lines with a specific log line, getting an ID from that line, and once I have a list of IDs I want to loop back through the log and... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

6. Shell Programming and Scripting

copying file information using awk & grep

Hi, TASK 1: I have been using this code to print the information of files kept at "/castor/cern.ch/user/s/sudha/forPooja" in some text file name FILE.txt. rfdir /castor/cern.ch/user/s/sudha/forPooja | grep data | awk '{print "rfio:///castor/cern.ch/user/s/sudha/forPooja/"$9}' > FILE.txt ... (6 Replies)
Discussion started by: nrjrasaxena
6 Replies

7. Shell Programming and Scripting

grep'ing dot history file

Hi, I tried to grep ".sh_history" (DOTsh_history) file and did not return anything though I found the word in .sh _history file through vi editor in Linux. Then I tried to grep ".profile" to check if it is the prob with hidden files and I got results. Then I verified the same with my friend... (4 Replies)
Discussion started by: bobbygsk
4 Replies

8. UNIX for Dummies Questions & Answers

grep'ing a variable - why not working

Hi all, Am writing a ksh script where I am looking for processes that has gone defunct and all of which has the same PPID PID is the variable that I need to match as this is the process ID of the processes that has gone defunct Am just curious how come the following DOES NOT work? ps... (6 Replies)
Discussion started by: newbie_01
6 Replies

9. UNIX for Dummies Questions & Answers

Grep? - using a file of terms to search another file when the information is on a different line

I have a flat file that looks like this, let's call it Chromosome_9.txt: FT /Gene_Name="Guanyl-Acetylase 9" FT /Gene_Number"36952" FT /Gene_Name="Endoplasmic Luciferase" FT /Gene_Number"36953" FT ... (4 Replies)
Discussion started by: Twinklefingers
4 Replies

10. Shell Programming and Scripting

sed / awk / grep to extract information from log

Hi all, I have a query that runs that outputs data in the following format - 01/09/12 11:43:40,ADMIN,4,77,Application Group Load: Name(TESTED) LoadId(5137-1-0-1XX-15343-15343) File(/dir/dir/File.T03.CI2.RYR.2012009.11433350806.ARD) InputSize(5344) OutputSize(1359) Rows(2) Time(1.9960)... (8 Replies)
Discussion started by: jeffs42885
8 Replies
masqmail.aliases(5)						   File Formats 					       masqmail.aliases(5)

NAME
masqmail.aliases - masqmail alias file format DESCRIPTION
This man page describes the format of the masqmail alias file. Its usual location is /etc/aliases. FILE FORMAT
The alias file consists of lines of the form: local_part: item1, item2, ... Items can be surrounded by double quotes `"'. If within the quotes other quotes are needed for an address they can be escaped with a leading backslash `'. A leading backslash `' indicates that this address shall not be further expanded. A leading pipe symbol `|' indicates that the item shall be treated as a pipe command. The content of the message will then be sent to the standard input of a command. The command will run under the user id and group id masqmail is running as. If quotes are needed, the pipe symbol must appear within the quotes. Loops will be detected, the offending address will be ignored. Aliases will be expanded at delivery time. This means that if there is a message still in the queue and you change any alias which matches one of the recipient addresses, the change will have effect next time a delivery is attemped. There is no need to restart masqmail or run any command when the alias file has been changed. AUTHOR
Masqmail was written by Oliver Kurth. It is now maintained by Markus Schnalke <meillo@marmaro.de>. You will find the newest version of masqmail at http://marmaro.de/prog/masqmail/. There is also a mailing list, you will find information about it at masqmail's main site. BUGS
Please report bugs to the mailing list. SEE ALSO
masqmail.conf(5), masqmail(8), masqmail-0.2.30 2011-07-27 masqmail.aliases(5)
All times are GMT -4. The time now is 04:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy