Search Results

Search: Posts Made By: erin00
11,847
Posted By RavinderSingh13
Hello erin00, Could you please try following...
Hello erin00,

Could you please try following and let me know if this helps.

cat script.ksh
echo $1 | awk -F ':' '{match($0,/[0-2][0-4]:[0-5][0-9]:[0-5][0-9]/);A=substr($0,RSTART,RLENGTH);if(A...
3,418
Posted By balajesuri
Convert the time stamp into number of seconds...
Convert the time stamp into number of seconds from epoch and then its a simple numerical comparison. Doing so is left as an exercise to the OP :-)
10,021
Posted By wisecracker
Shell scripting has no concept of GOTO. Try...
Shell scripting has no concept of GOTO.

Try using functions for your "yes/no" results and run your "case" routine inside a "while"
loop remembering to call you functions...
Example:-
yes()
{
...
10,021
Posted By balajesuri
while [ 1 ] do echo "yes or no?" ...
while [ 1 ]
do
echo "yes or no?"
read ans
case $ans in
[yY]es)
echo "yes"
# more statements
break
;;

[nN]o)
echo "no"...
1,261
Posted By port43
Personal preference? When I use a list it is...
Personal preference? When I use a list it is parsed imediately but I'll use an array when I want to save the values for later use. I don't think there's an easy way to reference a specific value in...
1,779
Posted By jim mcnamara
It depends on the command used to create the tar...
It depends on the command used to create the tar archive. If
tar tf tar_file.tar | grep filename

produces something like: ./filename or ./dir1/dir2/filename then if you use EXACTLY what tar tf...
3,068
Posted By MadeInGermany
A test -f must have exactly one argument. Try...
A test -f must have exactly one argument.
Try this instead

files=`
ls -lrt /dev/myfolder/someword* | grep "Oct 02" |
awk '{print $9}'
`
if [ -n "$files" ]
then
echo "$files"
else
...
3,068
Posted By balajesuri
[ -f /dev/myfolder/someword*Oct\ 02* ]
[ -f /dev/myfolder/someword*Oct\ 02* ]
1,962
Posted By Don Cragun
If you're using sed to get rid of the minus...
If you're using sed to get rid of the minus signs, the date string must be in a file. Try:
IFS='-' read X Y Z < date_file
printf '$X=%s\n$Y=%s\n$Z=%s\n' "$X" "$Y" "$Z"
Note that you don't need to...
1,962
Posted By ratheeshjulk
If you are not replacing - with space then the...
If you are not replacing - with space then the below will work.
x=$(echo $1|cut -d'-' -f1)
y=$(echo $1|cut -d'-' -f2)
z=$(echo $1|cut -d'-' -f3)
1,962
Posted By balajesuri
#! /bin/bash OLDIFS=$IFS IFS='-' read...
#! /bin/bash

OLDIFS=$IFS
IFS='-'

read x y z
echo "$x $y $z"

IFS=$OLDIFS
Showing results 1 to 11 of 11

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