Search Results

Search: Posts Made By: sv0081493
5,018
Posted By Franklin52
Sure. df -h | awk 'NF==1{f=$1;getline;$0=f FS...
Sure.
df -h | awk 'NF==1{f=$1;getline;$0=f FS $0} int($5) >=80 {print "CRITICAL\n" $1 " has reach " $5}' file

Explanation:

NF==1{f=$1;getline;$0=f FS $0} -> if the line has 1 field add the...
2,144
Posted By bakunin
Oops! This is true. Somehow the commata inside...
Oops! This is true. Somehow the commata inside the double quotes totally escaped my attention. Sorry, this was definitely not the best effort of mine.

In this case I'd like to modify my solution...
2,144
Posted By drl
Hi. My goal in this was to allow the most...
Hi.

My goal in this was to allow the most straight-forward awk statement { print $1,$2,$5,$6 } to solve the problem Of course, as MadeInGermany observed, there are quoted strings in which commas...
2,144
Posted By MadeInGermany
It's not that simple if the , within the quotes...
It's not that simple if the , within the quotes should not be field delimiters.
Especially if their count varies.
Yoda's solution works around it.

---------- Post updated at 03:32 PM ----------...
2,144
Posted By bakunin
The idea is simply to define what a "field" is,...
The idea is simply to define what a "field" is, by defining what separates one such field from the other. There is a variable "IFS" (Internal Field Separator), which does exactly this for Unix lines....
2,144
Posted By Yoda
awk -F, '{ print $1,$2,$(NF-1),$NF}' OFS=, file
awk -F, '{ print $1,$2,$(NF-1),$NF}' OFS=, file
1,735
Posted By drl
Hi. There is a ggrep on some Solaris...
Hi.

There is a ggrep on some Solaris systems:
$ ggrep -o good data1|wc -w
7

for:
OS, ker|rel, machine: SunOS, 5.10, i86pc
Distribution : Solaris 10 10/08 s10x_u6wos_07b X86...
1,735
Posted By Akshay Hegde
The gsub() ( global substitution ) function...
The gsub() ( global substitution ) function returns the number of substitutions made, it's just summed up and printed in END block.
1,735
Posted By Akshay Hegde
akshay@Aix:/tmp$ awk...
akshay@Aix:/tmp$ awk '{count+=gsub(/good/,x)}END{print "Total is "count}' file
Total is 7

akshay@Aix:/tmp$ cat file
good is good
but good is sometime bad and sometime good
you are very good...
2,185
Posted By Lucas_0418
Hi, may you double check that you have modified...
Hi, may you double check that you have modified this part of your code with chacko193's advice
if [ "$i"="puma" ]; then
the space " " between [ and "$i"
and the space " " between "puma" and ]
...
2,185
Posted By maverick72
Post the fifth line of your script. Can you...
Post the fifth line of your script.

Can you pull out the version of your ksh and let us know which operating system you are using :)

I've tried your script (with the [] mod and it works on my...
2,185
Posted By chacko193
To get rid of the error try : if [ "$i" =...
To get rid of the error try :

if [ "$i" = "puma" ] ; thenand here better use a double quote for sed instead of the single:

ps -ef|grep puma|grep -v grep|sed -n '2,$p' |awk -F ' ' '{print...
2,185
Posted By Akshay Hegde
if [ "$i" == "puma" ]; then
if [ "$i" == "puma" ]; then
2,185
Posted By anbu23
What is the output of your script? What is...
What is the output of your script? What is expected output?
1,883
Posted By radoulov
If in sqlplus test/##### you don't use a TNS...
If in sqlplus test/##### you don't use a TNS alias/service name/sid,
you'll need to add ORACLE_SID as well:

ORACLE_HOME=/test/orabase/product/9.2.0
PATH=$PATH:$ORACLE_HOME/bin
ORACLE_SID=<your...
1,883
Posted By radoulov
Yes, and you'll probably also need to export...
Yes,
and you'll probably also need to export the ORACLE_HOME variable
(and add <ORACLE_HOME>/bin to the PATH).
1,883
Posted By Don Cragun
A typical problem when using cron like this is...
A typical problem when using cron like this is that the environment that you have set up when you log in is not inherited by jobs run by cron. Assuming that sqlplus isn't on your system's default...
870
Posted By Scrutinizer
Try: ${STAMP}_ instead $STAMP_ (an underscore can...
Try: ${STAMP}_ instead $STAMP_ (an underscore can be used in variable names)
It is also a good idea to put variable reference inside double quotes, for example:
"/path of file/TEST${STAMP}_$dltm"
1,737
Posted By capitanui
Your script should look something like this : ...
Your script should look something like this :

#!/bin/bash

#Get the number of processes containing etl running
VAR=`ps -ef | grep 'etl' | grep -v grep | wc -l`

#Verify if VAR >= 1
if [ $VAR...
1,737
Posted By capitanui
ps - ef - lists processes grep test - print...
ps - ef - lists processes
grep test - print output lines that contain "test"
grep -v grep - excludes the "grep test" process you ran earlier from the list
1,737
Posted By smoofy
I would try this: ps -ef | grep test | grep -v...
I would try this:
ps -ef | grep test | grep -v grep
if [ $?==1 ] then; echo "test does not work" |mail -s "confirmation" my@address.com; fi
But I am sure there is more elegant way :)
3,828
Posted By elixir_sinari
monyr=$(date +%b%Y) for i in AB BC CD DF do ...
monyr=$(date +%b%Y)
for i in AB BC CD DF
do
mkdir -p /home/path/$i/$monyr
done
1,013
Posted By Skrynesaver
Calling something akin to the following from cron...
Calling something akin to the following from cron should work.


#!/usr/bin/perl

use strict;
use Net::FTP;
my $username="$ENV{USER}"; # or whoever the ftp account belongs to
my $password =...
11,129
Posted By balajesuri
@sv0081493: Don't you think you should mention in...
@sv0081493: Don't you think you should mention in Post #1 (https://www.unix.com/302710311-post1.html), from where you got that perl code (https://www.unix.com/302709359-post3.html) !
11,129
Posted By rdrtx1
if the % column is # 2 (otherwise change...
if the % column is # 2 (otherwise change $pct_col):


#!/bin/ksh
perl -F',' -lane 'BEGIN{
$pct_col=2;
@bgc=("lightgreen","lightsteelblue");
open O, ">output_db.html"; print O...
Showing results 1 to 25 of 34

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