Search Results

Search: Posts Made By: swayam123
905
Posted By swayam123
Help with awk statement
echo "$line"|awk 'x = 1;{for(i=1;i<=NF;i++) if ( $i ~ /[0-9]:[0-5][0-9]:[0-5 ][0-9]/){x = 0;print 1}}if ( x == 0){ print -1}'

This code is suppose to read a variable $line and return 1 if the...
2,214
Posted By swayam123
Using the variable name as time was causing the...
Using the variable name as time was causing the problem.
Changed it to t and the the variable in quote fixed the problem.
Thanks you all folks
2,214
Posted By swayam123
This the code for chkTimeFormat.sh is as follows ...
This the code for chkTimeFormat.sh is as follows
time=$1
var=$(echo "$time"|awk '{for(i=1;i<=NF;i++) if ( $i ~ /[0-2][0-9]:[0-5][0-9]:[0-5][0-9]/){print i}} ')

if [ $var -ge 0 ]
then
echo 1...
2,214
Posted By swayam123
Thanks but , . chkTimeFormat.sh "$time"|read c...
Thanks but ,
. chkTimeFormat.sh "$time"|read c

it did not work.
Any more ideas...
2,214
Posted By swayam123
Passing a variable as input to another shell
I have a shell program that calls another shell program

the following code works
. chkTimeFormat.sh "10/9/12 17:51:19:783."|read c

but when I am passing the the time in a variable like in...
1,666
Posted By swayam123
UNIX function
I have a code like this


v_time=12:12:12
correctTimeFlag=$(echo $v_time|awk '{for(i=1;i<=NF;i++) if( $i ~ /[0-2][0-9
]:[0-5][0-9]:[0-5][0-9]/){print i}}')

if [ correctTimeFlag -gt 0 ]
then...
15,928
Posted By swayam123
Assigning numeric values to variable
I have a code like this

v_num=9
comp_num=39
if [$v_num -gt $comp_num]
then
echo "pass"
fi
echo "end"

I am getting an error

ksh: [9: not found
end

When I change the code to ...
1,151
Posted By swayam123
Getting the index of a string in a string
I have a variable
$line= Some text with ERR message

I want to get the value of the index of ERR and assign to a variable say $index

I expect the output
echo $index
16

I tried to use match...
49,739
Posted By swayam123
How can I pass the date string pattern as...
How can I pass the date string pattern as variable
I am trying to run this in a shell script.
In the following way


awk -v x="11\/20\/12" '/x/,EOF{print $0}' datefiltertestfile.txt


This...
49,739
Posted By swayam123
awk to print all lines after a pattern is found
Is there a way with aw to print all lines after a string is found

There is a file like this

.......
........
2012/19/11 :11.58 PM some data
lne no date
2012/19/11 :11.59 PM some other data...
1,522
Posted By swayam123
Get N lines before a pattern
I need to print N lines before a pattern ERR-XXXXX .

The grep around and before option is not working for me.




input file
line 1 some text
line 2 some other text
line 3 ERR-12345
line...
1,211
Posted By swayam123
myFunc(){ echo "In Function ...processing $1" ...
myFunc(){
echo "In Function ...processing $1"

echo "awk '/\[$1/{sub("\\[","",$0);a=$0}/^ORA/{print a"-"$0}'"
awk '/\[$1/{sub("\\[","",$0);a=$0}/^ERR/{print a"-"$0}' $2.log>>$3

awk...
1,211
Posted By swayam123
the command is working in the shell. However...
the command is working in the shell.
However when calling this same command from a function
$0 is getting replaced by KSH and the date part is not coming only ERR part is coming

like this...
1,211
Posted By swayam123
Getting value of a pattern preceding another pattern
I have a file like this
-------------------------------
[2012-11-12 : 11:59
some text
some moe text
ERR-XXXXX
soe more text
]
[2012-11-12 : 12:00 blala blah blah]
[2012-11-12 : 12:01
...
5,262
Posted By swayam123
rdrtx1, thanks for your suggestion , I checked ,...
rdrtx1, thanks for your suggestion , I checked , multiple environment (including those where mailx is working) there are no server informaton here..
There are 3 entries
broadcastclient
driftfile...
5,262
Posted By swayam123
mailx giving error domain of sender do not exists
Hi ,
mailx is unable to send mail , I am getting the following error

Diagnostic-Code: SMTP; 553 5.1.8 <bc00644@dev-app01-wms.domain.fds>... Domain of sender address...
2,531
Posted By swayam123
The modified script, couple of typos removed ...
The modified script, couple of typos removed
awk '
{while(match($0,/ERR-[0-9]{5}/))
{
c[substr($0,RSTART,RLENGTH)]++ sub(/ERR-[0-9]{5}/,"")
}
} END
{for(i in c) print i "="...
2,531
Posted By swayam123
Hi Bipinajith, Thanks , for your prompt...
Hi Bipinajith,

Thanks , for your prompt reply.
I am getting a message
grep: illegal option -- o

I am using ksh

The output without the -o option also seems to work, what are we trying to...
2,531
Posted By swayam123
Search for a pattern in a String file and count the occurance of each pattern
I am trying to search a file for a patterns ERR-[0-9][0-9][0-9][0-9][0-9] in a file and return a count for each of the error reported

Input file is a free flowing file without any format
...
4,004
Posted By swayam123
It s working for a different user
It s working for a different user
4,004
Posted By swayam123
I am getting the following error on sed command ...
I am getting the following error on sed command
This generating the following error

[2012-11-01 02:08:39,943 | ERROR | WebContainer : 3 | | MRF - Report UI] Print Requestor is not setup for user...
4,004
Posted By swayam123
Copy part of file between two strings to another
I am a newbie to shell scripting
I have a large log file , i need to work on the part of the log file for a particular date.

Is there a way to find the first occurance of the date string and last...
Showing results 1 to 22 of 22

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