I need to fetch data from logfile between two given dates,i got the below code from our forum.It works perfect,but i need to enter the value dynamically to awk while running.
i tried the below code,but it not accepting the variable which i pass,displays all the lines in the file.
Please advice me,thank u guys
Try this:
This User Gave Thanks to Franklin52 For This Post:
Does anybody have an explanation for the following:
The following scripts runs fine on IRIX64 6.5 but has bugs on Solaris 8.
#! /bin/sh
echo run only on an SGI machine
echo type in linenumber
read j
echo value
read value
awk -f rmspass2 level=$value $j'step1.mlf'
When the script is... (5 Replies)
Hi
I have a unix shell script with an awk statement. I would like to print some of the fields of an input file. However, I would like to print them dynamically, ie by passing the literal $1 $3 into the script to define the output.
I have tried the following:
variable1='$1'
awk... (2 Replies)
I am trying to pass the results from a variable gathered from awk, however when I echo the 'PARSE' and 'SUB', the response is blank. This is my command.
awk -F= '/Unit/''{ PARSE=substr($2,1,5) ; SUB=substr($2,1,1) }' inputfile.lst
Is this a kind of valid attempt or am I obligated to declare... (3 Replies)
Hi,
How to pass space seprated variables in awk. (HP-UX, sh shell)
I have the problem like below:
var="Hello"
var2="Manu Batham"
echo $var2 | awk -v variable=${var} '{ printf "%s %s", variable, $1}'
and its output is:
Hello Manu
while output should be:
Hello Manu Batham
Please... (4 Replies)
Hi.
I need to parse file and assign some values to variables, right now i do like below
MYHOMEDIR=`awk '/Home/ {print $NF}' output.txt`
MYSHELL=`awk '/Shell/ {print $NF}' output.txt`
PRGRP=`awk '/Primary/ {print $NF}' output.txt`
SECGRP=`awk '/Second/ {print $NF}' output.txt`
In this... (10 Replies)
Using ksh to call a function which has awk script embedded.
It parses a long two element list file, filled with text numbers (I want column 2, beginning no sooner than line 45, that's the only known thing) . It's unknown where to start or end the data collection, dynamic variables will be used. ... (1 Reply)
I'm trying to use awk to write new entries to a hosts file if they don't exist. I need to do so depending on the type of system I have. Below is what I have, but it isn't working.
awk -v myip1=$IP1 myip2=$IP2 myhost1=$HOST1 myhost2=$HOST2' BEGIN { mqhost1=0; mqhost2=0; stap1=0; stap2=0; }
... (4 Replies)
Hi all,
I am wanting to pass variables from a file to an awk arithmetic formula.
When I use the formula with the value it works well. As soon as I make these variables I get an inf (infinity) response. I can certainly echo the variables back and they look correct. My googling for answers has... (3 Replies)
Am looking to pass some Linux environment variables into AWK , can I simply use the -v option ?
awk -F: -v AHOME=$HOME '{ if
{rm AHOME/file.txt
a=2 } }'
config.txt
... (4 Replies)
Discussion started by: alldbest
4 Replies
LEARN ABOUT DEBIAN
prev
PREV(1) [nmh-1.5] PREV(1)NAME
prev - show the previous message
SYNOPSIS
prev [+folder] [-showproc program] [-showmimeproc program] [-header | -noheader] [-checkmime | -nocheckmime] [switches for showproc or
showmimeproc] [-version] [-help]
DESCRIPTION
Prev performs a show on the previous message in the specified (or current) folder. Like show, it passes any switches on to the program
named by showproc or showmimeproc, which is called to list the message. This command is almost exactly equivalent to "show prev". Consult
the manual entry for show(1) for all the details.
FILES
$HOME/.mh_profile The user profile
PROFILE COMPONENTS
Path: To determine the user's nmh directory
Current-Folder: To find the default current folder
showproc: Program to show non-MIME messages
showmimeproc: Program to show MIME messages
SEE ALSO show(1), next(1)DEFAULTS
`+folder' defaults to the current folder
`-checkmime'
`-header'
CONTEXT
If a folder is specified, it will become the current folder. The message that is shown (i.e., the previous message in sequence) will
become the current message.
BUGS
prev is really a link to the show program. As a result, if you make a link to prev and that link is not called prev, your link will act
like show instead. To circumvent this, add a profile-entry for the link to your nmh profile and add the argument prev to the entry.
MH.6.8 11 June 2012 PREV(1)