Sponsored Content
Top Forums Shell Programming and Scripting How to read and write last modified timestamp to files? Post 302885493 by Tribe on Monday 27th of January 2014 02:21:13 AM
Old 01-27-2014
Quote:
Originally Posted by balajesuri
1. The %Y format specifier in stat -c command gives the time output in unix time from epoch.
2. I tried the command on Terminal IDE app (BusyBox v1.19.2) installed on my android phone (running Android v4.3) and it works just fine. Here's a screenshot.

Attachment 5496
Code:
$ date -d @$(stat -c%Y file) +"%Y%m%d%H%M%S"
unknown option -- ddate: invalid option -d


Last edited by Tribe; 01-27-2014 at 03:26 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to read and write files one line at a time.

Hi! All! I am wirting a shell script in which i want to read one line at a time from the file and write it simultaneouly to other file one line at a time. Please let me know about some shell utility which can help me out. Thanx. If further clarifications are needed then please let me know... (2 Replies)
Discussion started by: s_chopra
2 Replies

2. Shell Programming and Scripting

Script with read/write Files

Hello, I am a Newbie in ksh Unix Script. So I must write a ksh/sh script who read character at a position in a File. So also it must read all the lines who belongs at these characters , then write these lines in a another File. Can you help me , or give little councils to advance with my... (5 Replies)
Discussion started by: steiner
5 Replies

3. UNIX for Dummies Questions & Answers

how to read or write device files

hi everybody, i am working in device drivers.As a beginner to this field ,i dont know how to read or write device files. Will copy_to_user and copy_from_user help me? I have created a device file using mknod command .Can anybody help me in this regard :confused thanks in advance sriram (1 Reply)
Discussion started by: sriram.ec
1 Replies

4. Shell Programming and Scripting

SED command for read and write to different files

Hi I need some help on SED command I am writing a shell script which does the following: 1. Read one line at a time from a file abc.txt which has millions of lines 2. Prefix each line read with some text " 3. Post fix each line read with a quote " 4. Write the new modified... (11 Replies)
Discussion started by: gaurav_1711
11 Replies

5. Shell Programming and Scripting

Find all files with group read OR group write OR user write permission

I need to find all the files that have group Read or Write permission or files that have user write permission. This is what I have so far: find . -exec ls -l {} \; | awk '/-...rw..w./ {print $1 " " $3 " " $4 " " $9}' It shows me all files where group read = true, group write = true... (5 Replies)
Discussion started by: shunter63
5 Replies

6. Shell Programming and Scripting

How to get a filename modified by attaching modified timestamp

Hi, I want to modify a filename in AIX by attaching the last modified timestamp. I want the timestamp completely in numerical format (eg:200905081210. yr-2009, mnth - 05, date -08, hr - 12, mins - 10). For example if the filename is a.log and it was modified on April 6th 2008 at 21.00. I... (16 Replies)
Discussion started by: Ruks
16 Replies

7. Programming

read/write files

Hi all, I have a problem with some read/write functions. I have a .bin file which contains a lot of structures as follows: struct alumno { char id; char apellido1; char apellido2; char nombre; float nota1p; float nota2p; float notamedia; char photofilename; }; What I have... (3 Replies)
Discussion started by: Attenea
3 Replies

8. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

9. UNIX for Dummies Questions & Answers

Finding the modified timestamp of files from the piped output of du command

Version Info +++++++++++++++ RHEL 5.4 Since ls command lists file sizes in Bytes which can be long I use du command like below. I have run the du command for the below files as shown below. But I want pipe this output to ls command just to see the modified timestamp for these files. ... (7 Replies)
Discussion started by: kraljic
7 Replies

10. Shell Programming and Scripting

Read and write operations on files.

Dears. kindly guide !!! I have data, which is delimited by | . it should contain 26 columns, but one column data contain | makes few row to 27 columns. I want to find rows have 27 columns and then concatenate the specific columns to single column to make it 26 columns. Kindly help, Can... (3 Replies)
Discussion started by: sadique.manzar
3 Replies
BIO(1)							      General Commands Manual							    BIO(1)

NAME
bio - Barry Input / Output SYNOPSIS
bio -i <input type> [input args] -o <output type> [output args] [-o <output type> ...] DESCRIPTION
bio is a command line tool that treats devices, backups, and data streams as input and output. bio supports the following types of IO (actual type name shown in bold): device tar (backup files) boost (serialization files and streams) mime streams ldif streams human readable and hex text dump sha1 sum output cstore for extracting Content Store records Each command line consists of at least one input and output option, along with their switches. More than one output can be used, as long as they do not conflict with each other. For example, it is not possible to read and write from the same device PIN. This tool combines a lot of the functionality of btool, btardump, brecsum, and bs11nread, but does it more flexibly, and improves function- ality in some cases, such as Boost archives being able to contain more than one database. DEVICE TYPE OPTIONS
The device type is used to read or write from a device connected via USB. Some of the options below are valid only in one input or output mode, some in both. -d db Name of database to load, when using the device type as input. Can be used multiple times. See btool -t for a list of databases on the device. -A Selects all databases found on the device, instead of adding them manually via the -d option. -p pin PIN of device to talk to. Valid for both input and output. Only needed if you have more than one Blackberry connected at once. -P password Simplistic method to specify device password. In a real application, this would be done using a more secure prompt. -w mode Set write mode when using the device type in output mode. This must be specified, or nothing will be written. Can be one of: erase, overwrite, addonly, addnew. erase Erases all records from existing database and adds all new records to the device, using their Unique IDs, if available. This is what you would normally use to restore a backup. overwrite Adds any new records, and for records with Unique IDs that already exist on the device, overwrite them. addonly Adds any new records, but if a record exists in the device with the same Unique ID, skip that record and don't write it to the device. addnew Adds all incoming records as brand new records, generating a new Unique ID for each one, and leaving any existing records intact. This may cause data duplication if you're restoring data that initially came from this same device. Use this for copying data from another device, while keeping your existing records. TAR TYPE OPTIONS
The tar type is used to read or write from a backup file created by btool or the backup GUI. -d db Name of database to load, when using the tar type as input. Can be used multiple times. Note that if no -d options are specified, bio defaults to reading all available databases. -f file The tar backup file to read or write from. Bio uses gzip compressed tar files, so suitable extensions would be .tgz and .tar.gz. Unfortunately, due to internal limitations, an actual file must be specified here, and not - for stdin / stdout. BOOST TYPE OPTIONS
The boost type is used to read and write parsable records in Boost Serialization format. These files were historically written and read by btool and bs11nread. Bio is more flexible, in that it can contain multiple databases in one serialization archive. -f file Filename to read from or write to. Use - to specify stdin or stdout. If not specified for input, defaults to stdin, but since out- put can contain non-ASCII chars, you must use -f - if you want to write to stdout. LDIF TYPE OPTIONS
The ldif type is used to read or write ldif output, like the output of the LDAP command line tool ldapsearch. -c dn When using ldif as output, specify the base DN. -C dnattr Again, for output, specify the attribute name to use when building the FQDN. MIME TYPE OPTIONS
The mime type is used to read or write VCARD, VEVENT, VTODO, or VJOURNAL records based on the Address Book, Calendar, Tasks, or Memos data- bases respectively. -f file Filename to read from or write to. Defaults to - for stdin or stdout. DUMP TYPE OPTIONS
The dump type is used only for output, and sends human readable record data to stdout. Parsable records are parsed; unknown records are dumped in hex format. -n Use hex format for all records. SHA1 TYPE OPTIONS The sha1 type is used to mimic the behaviour of the brecsum command. It calculates a SHA1 sum on the raw record data and sends the sum to stdout. -t Include the DB Name, Type, and Unique record ID in the checksum for each record. CSTORE TYPE OPTIONS
The cstore type is used to parse Content Store records. -l List the filenames and folders found in the Content Store database. -f file Select a filename from the above list to extract and save locally. Specify the entire path as shown in the -l list. If the file is found in the device, it will be written to the current directory, using the base filename as the name. If a file by that name exists already, the filename will be modified to avoid overwriting local files. STANDALONE OPTIONS
-h Displays a detailed summary of command line options. -I cs Set the international charset for string conversions. Valid values here are available with iconv --list -S Show list of supported database parsers and builders. -v Dump verbose low level protocol data during USB operations, to stdout. EXAMPLES
1) Backup a full device to tar backup: bio -i device -A -o tar -f mybackup.tar.gz 2) Read a backup file and convert the Address Book to MIME bio -i tar -f mybackup.tar.gz -d "Address Book" -o mime 3) Restore a single database to a device bio -i tar -f mybackup.tar.gz -d "Address Book" -o device -w erase 4) Copy the Calendar from one device to another, and dump the records to stdout in human readable format at the same time bio -i device -p 3009efe3 -d Calendar -o device -p 204062f3 -w erase -o dump 5) Read LDIF input and convert the contacts to MIME format ldapsearch -x | bio -i ldif -o mime 6) Test the record code by running the Tasks database through the Boost storage and back to human readable bio -i device -d Tasks -o dump vs. bio -i device -d Tasks -o boost -f - | bio -i boost -f - -o dump AUTHOR
bio is part of the Barry project. SEE ALSO
http://www.netdirect.ca/barry May 17, 2011 BIO(1)
All times are GMT -4. The time now is 03:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy