12-05-2011
Transforming and calculating timestamps isn't trivial and different systems have different utilities for it. If you don't have Linux you might have to do at least some bits in Perl. What's your system?
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have to capture the creation date and time stamp for a file. The ls command doesn't list all the required information. I need year, month, day, hour, minute and second.
Any ideas... (1 Reply)
Discussion started by: Xenon
1 Replies
2. UNIX for Dummies Questions & Answers
I have a file that I want to read each record, do some stuff and write a new file.
I get as far as:
file=`cat data.txt`
for data in "$file"
do
echo "Record is: $data"
done
The output of this is not what I was expecting:
Record is: This is record one
This is record two
This is... (4 Replies)
Discussion started by: app4dxh
4 Replies
3. Shell Programming and Scripting
Hi,
I am doing :
while read line
do
printf "%s\n" ${line}
done <datafile.txt
but I am not getting each single line from the data file assigned to the variable line (but only tokens/fields at a time). I also tried while IFS= read -r lineI want the whole line assigned or read into the... (2 Replies)
Discussion started by: shri_nath
2 Replies
4. Shell Programming and Scripting
So, I want to read line-by-line a text file with unknown number of files....
So:
a=1
b=1
while ; do
b=`sed -n '$ap' test`
a=`expr $a + 1`
$here do something with b etc
done
the problem is that sed does not seem to recognise the $a, even when trying
sed -n ' $a p'
So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies
5. Shell Programming and Scripting
Hi
I use "touch -t xxxxxxxx" command to set date/time stamp of a file. My requirement is to read the date/time stamp of a file and apply it to another file.
Is there anyway to do it simple instead of manually taking date/stamp of first file?
TIA
Prvn (2 Replies)
Discussion started by: prvnrk
2 Replies
6. Shell Programming and Scripting
I have file A.txt
A 1023
B 123
C 1223
I want output
Hello_12PM_A 1023
Hello_12PM_B 123
Helll_12PM_C 1223
Add Hello and time stamp in AM and PM. (4 Replies)
Discussion started by: asavaliya
4 Replies
7. Shell Programming and Scripting
Hi All,
I have been using a program on windows called AutoKey.
My environment at work is Linux and I have been experimenting with expect. Very powerful. I can move my AutoKey scripts to Linux using Expect once I am educated on how to read from a file using Expect.
My application would be... (1 Reply)
Discussion started by: quemalr
1 Replies
8. Shell Programming and Scripting
I need some help. I would like to read in a text file.
Take a variable such as ROW-D-01, compare it to what's in one line in the text file such as PROD/VM/ROW-D-01 and only input PROD/VM into a variable without the /ROW-D-01.
Is this possible? any help is appreciated. (2 Replies)
Discussion started by: xChristopher
2 Replies
9. Shell Programming and Scripting
I have a test file with the following format, It contains the username_date when the user was locked from the database.
$ cat lockedusers.txt
TEST1_21062016
TEST2_02122015
TEST3_01032016
TEST4_01042016
I'm writing a ksh script and faced with this difficult scenario for my... (11 Replies)
Discussion started by: humble_learner
11 Replies