how to write a shell script that print the last modified file ?
Hi guys,
-could any one help me with this (I'm new to UNIX)
how to write a shell script that tell me the last modified file in the current directory?
so if I run the script in a diferent directory,will work.
and can I write the script by C++ language and run it in the shell ?
I tried
but I couldn't save the first one (which is the last modified) in a $M
also I tried to use
but I couldn't,coz I have no idea about it
I'll be thankfull if any one help,and I promise that I'll be helpfull member when I start understanding UNIX
it's works with directories ,not files
this one
ls -alst
works good for me ,it's works when I write
ls -alst | tail -1 and gives me the the first file
but it doesn't work when
ls -alst | head -1
coz I need the last modified one
If you need to remove directories from the listing, something like this perhaps.
The sed script is shorthand for grep -v '^total' | grep -v '^ *[1-9][0-9]* d' | head -1 -- combining those into a single script is somewhat more elegant IMHO, but the pipeline with multiple greps and a head will work fine as well. The first grep is to remove the "total 12345" printed on the first line, and the second grep is to remove any directories; the regular expression matches beginning of line, followed by optional spaces, followed by a number (this is what ls prints with the -s option on my system) followed by a space and a d which indicates that the entry is a directory. Without the -s option, you would simply remove any line with d as its first character; that's grep -v '^d'
Hi Everyone,
I want your help to write a script which will take text file as input and on the basis of delimiter ":"script will create excel sheet.
Example input:
IpAdress:InstanceName:Port:ServerName
10.255.255.1:abc:2232:xyz_abc
Output should be an excel sheet like below:
Column... (8 Replies)
Hi Guys,
I need to write a simple shell script which will generate a .csv file/report by calling .sql file inside a shell script.
Can somebody help me on this.
Thanks in advance!
Regards,
LK (7 Replies)
Hi ,
I want a script who will send alert the moment someone edit any file in a directory in LINUX. Can some one throw some light on this please.!! (4 Replies)
Hello,
I need to do one thing that my script creates the file
touch release.SPLASH_12_03_00_RC01.txt
Now I want to update that file with some content e.g
splashbuild::SPLASH_12_17_00_RC02.zip
Thanks (1 Reply)
All,
Can anyone please help me with the below scenario in korn shell script.
Can anyone please give me some hints to proceed on this.
I have a Flat file of the below format.
Input file format:... (1 Reply)
hi,
I need some help in writing shell script in a bourne shell.I am trying to rename the file..
eg.
find /root/data -type f -name "text*) | while read FILES
do
newfile=${FILES/type_2.0_20101208_34.xml / tmp.xml}
mv "$FILES" "$newfile"
done
above written script is working...If the... (7 Replies)
hi ..
i have a problem how to search file with date and version number(ms_2.0_dd/mm/yy_24)in folder.Here 24 is version number and compare the this file to other file which is in another folder and if does not match then copy this file to respective folder.Also copy different files in different... (1 Reply)
I have a server and occasionally the file mysqld.log would show something like
/usr/libexec/mysqld: Disk is full writing './example_com_-_wordpress/wp_statpress.MYD' (Errcode: 122). Waiting for someone to free space... Retry in 60 secs
How do I write a simple shell script to check mysqld.log... (1 Reply)
i have no idea abount shell script but i need need shell script to get last 10 char from a file name and write in to a new file.
consider u hav 5 files in a particular dir i script should get last 10 char of each file n write the 10 char in separate files (2 Replies)