9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
In one of my previous threads, someone suggested not to use backticks. When I googled, I came to know that back ticks are deprecated instead $() should be used. But I face issue while using $().
Note: I used echo of the sql just to debug.
The following is the code
#!/bin/ksh
#set -x... (5 Replies)
Discussion started by: bobbygsk
5 Replies
2. UNIX for Dummies Questions & Answers
I have file with below data
00:00:00
00:00:00
00:00:00
00:00:01
00:00:01
00:00:01
00:00:01
00:00:01
00:02:01
00:02:01
00:02:01
so on till
23:59:59
I want count of seconds for each hour and minutes
say for 00:00:00 its 3 and 00:00:01 its 5 and 00:02:01 its 3 and so on... (8 Replies)
Discussion started by: mirwasim
8 Replies
3. Shell Programming and Scripting
Hi,
In my perl script I want to check whether *.csv files exist and take the count .
Below is the code:
$path = “/home/usr/jan/myfiles”
my $File_Count = `ls *.csv | wc -l `; # Checks in the current directory #Works fine if files exists.
my $File_Count = `ls $path/*.csv | wc -l `; # I need... (2 Replies)
Discussion started by: jisha
2 Replies
4. Shell Programming and Scripting
ok so, I recently started using $(echo one two three) to execute commands in scripts instead of using `echo one two three`.
This method works wonderfully on ubuntu. However, it doesn't seem to work on other unix systems, i.e redhat/sun sun solaris.
I really hate to go back to the ticks "`"... (2 Replies)
Discussion started by: SkySmart
2 Replies
5. Shell Programming and Scripting
date1=$(date +"%H:%M:%S")
date2=$(date +"01:00:54")
diff=$date2-$date1
echo $diff
How to get the time difference in seconds. (4 Replies)
Discussion started by: sandy1028
4 Replies
6. Shell Programming and Scripting
Hi All
I need to convert a number of fields in a record from seconds to hh:mm:ss ( or possibly hhh:mm:ss ). I'm guessing awk is the way to go .
File has multiple records and each record contains 101 fields - can awk handle that ? The seconds values will be in fields 3 - 101 and could be 0.
... (4 Replies)
Discussion started by: Mudshark
4 Replies
7. UNIX for Dummies Questions & Answers
Any sleek way to convert seconds to hh:mm:ss format .
I know it can be done by mod and divide . Looking for a one liner if possible .
Example
3600 seconds = 01:00:00
3601 seconds = 01:00:01 (2 Replies)
Discussion started by: akrathi
2 Replies
8. Shell Programming and Scripting
Hello everybody, how i can get how many lines are writed in a file in the last 5 seconds?
For ezample i have 'file1' that is filled by a process automatically and i neet to know how many lines with the word 'EXACTO' were filled the last 5 seconds, can somebody help me?
I try with:
tail -f... (16 Replies)
Discussion started by: Lestat
16 Replies
9. UNIX for Advanced & Expert Users
How do I get the number of seconds since 1970, within a script, for the previous day at 23:59? I need this value to pass into a sql statement to cleanup records older than the previous day at midnight. It will be automated via cron so no hard coding allowed.
Thanks! (2 Replies)
Discussion started by: captainzeb
2 Replies