Search Results

Search: Posts Made By: kshji
1,540
Posted By kshji
Multiple file testing like rbatte1 tried to tell,...
Multiple file testing like rbatte1 tried to tell, if you need only know if some while include something.

found=0
for f in A*.rej
do
[ ! -s "$f" ] && continue
found=1
break
done
[...
2,198
Posted By kshji
Maybe this example helps use to make comparing...
Maybe this example helps use to make comparing little easier in shell. You can add breaks as you like.

for file in *.txt
do
stat="DEPTH"
while IFS="," read f1 f2 DEPT SDEPT rest
do...
1,922
Posted By kshji
Most of syntax between ksh93...
Most of syntax between ksh93 (https://github.com/att/ast) and bash is same. All previous scripts works fine in bash (http://www.gnu.org/software/bash/manual/bashref.html) and ksh93.
Both support...
1,349
Posted By kshji
awk ' BEGIN { FS=":" } ...
awk '
BEGIN {
FS=":"
}

{ # default for all lines
color="yellow"
}

$1 == "red" {
color=$1
}

{ # all lines
...
2,219
Posted By kshji
Example forever loop and if status is 0, then...
Example forever loop and if status is 0, then break the loop. Case is nice command to use string comparing.


#!/bin/bash
# or ksh
while true
do
# your db code here
# after that:...
2,014
Posted By kshji
Here is pure bash...
Here is pure bash (ftp://ftp.gnu.org/pub/gnu/bash/)/ksh93 (https://github.com/att/ast) solution. Not used any external commands like awk, perl, grep, sed, ...

If you have too old bash, update it....
1,095
Posted By kshji
Here is example to use ksh93...
Here is example to use ksh93 (http://www2.research.att.com/~astopen/cgi-bin/download.cgi?action=list&name=ksh) shell, which include builtin date calculation properties.

In other shell you can use...
4,911
Posted By kshji
After started bg process, save child process...
After started bg process, save child process process id (variable !).


db2 "Call PROC1" &
pid1=$!

db2 "Call PROC2" &
pid2=$!

db2 "Call PROC3" &
pid3=$!


# then only wait that every...
4,699
Posted By kshji
You trying HERE input ? syntax is cmdline...
You trying HERE input ?
syntax is

cmdline <<EndOfInputString
data
EndOfInputString

# ex.
cmdline <<EOF
data
EOF
2,729
Posted By kshji
Publishing more code maybe give us more...
Publishing more code maybe give us more understanding.

Both rule works if input is as you have written.

# awk rule using default FS
$1 == "Swap:" { # do something
}
# or...
2,277
Posted By kshji
This give the number of csv files in current...
This give the number of csv files in current directory tree.

count=$( find . -type f -name "*.csv" | wc -l )
echo $count
2,679
Posted By kshji
You can test also empty string without X...
You can test also empty string without X extension - this example is cut&pasted worldwide, but sh shells don't need it. You can test simple

if [ "$FILE_SIZE" = "" ] ; then # value is empty
...
2,220
Posted By kshji
Awk is awk, it has own syntax. Something same as...
Awk is awk, it has own syntax. Something same as in C, but lot of own, whole rule for block idea is something different.

Shell is shell and it has own syntax.

Awk is not part of shell. It's own...
1,667
Posted By kshji
Bash and ksh93 you can use (( )). if ((...
Bash and ksh93 you can use (( )).

if (( ex_year >= curr_year && ex_month >= curr_month && ex_day <= curr_day ))
then
condition...
fi


This work in every sh, dash,...
1,502
Posted By kshji
If you have not eXcute priviledge in the script...
If you have not eXcute priviledge in the script file, then you need start the interpreter like sh and input is readed from file (arg 1).

If your input file not include needed interpreter then...
2,914
Posted By kshji
FreeTDS (http://www.freetds.org/) Download...
FreeTDS (http://www.freetds.org/)

Download FreeTDS (http://mirrors.ibiblio.org/freetds/stable/)

Using tsql, bsqldb, freebcp

TDSVER=4.7
tsql -H sqlserverIP -p 1433 -U username -P password...
1,061
Posted By kshji
In the shell scripts if is also command. Looks...
In the shell scripts if is also command. Looks like if in the programming languages but it's not same.
After if is some command, example test or shortly [ or compound command [[ or even cp or ...
...
10,310
Posted By kshji
xargs is nice command when you need to give some...
xargs is nice command when you need to give some output to the next command arguments

some_command_output | xargs kill

Example kill apache processes

ps -ef | grep apache | grep -v grep | awk...
2,975
Posted By kshji
Add redirect , then cron not send email. * *...
Add redirect , then cron not send email.

* * * * * /some/command >/dev/null 2>&1
3,020
Posted By kshji
You can do solution using select PS3="Your...
You can do solution using select

PS3="Your choice (ENTER=list again, e=end):"
select f in *.zip
do
[ "$REPLY" = "e" ] && break
echo "Choice: ($REPLY) $f"
echo $f
...
3,378
Posted By kshji
Here are two solution, using pure ksh/bash or...
Here are two solution, using pure ksh/bash or awk, not mixed.

#!/usr/bin/someposixshell ksh, bash, dash, ...

# make tmp file for input
cat <<EOF > $0.tmp
Name : sdt2156157_ID
NOS : 4567 [...
2,001
Posted By kshji
awk ' /^A/ { begin=$0 } # line start A ...
awk '
/^A/ { begin=$0 } # line start A
/^B/ { print begin $0 } # line start B
' inputfile
31,893
Posted By kshji
Something like this: echo -n "number:" ...
Something like this:

echo -n "number:"
read res
PS3="select operation (ENTER=menu again, e=end):"
select f in add sub div mul
do
[ "$REPLY" = "e" ] && break
echo -n "number:"...
2,085
Posted By kshji
After if it's always command in shells: [, [[, ((...
After if it's always command in shells: [, [[, (( are only some commands.

if commandline
then # exit status 0
:
else # exit status != 0
:
fi

[ and test are same command, usually...
2,085
Posted By kshji
Return is exit from function. Not for return...
Return is exit from function. Not for return values. Stdout is method to return values.
$? = last command exit status, 0=ok, <>0 not so ok.

pattern()
{
val1=$1
val2=$2
(( val1 == 100...
Showing results 1 to 25 of 57

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