03-10-2008
The simple way as below
>> file content
[root@ganen test]# cat testfile
total 150
drwxr-xr-x 2 root root 4096 Mar 27 2007 bin
drwxr-xr-x 4 root root 1024 Aug 19 2006 boot
drwxr-xr-x 11 root root 5480 Oct 23 22:21 dev
drwxr-xr-x 86 root root 12288 Mar 10 04:03 etc
drwxr-xr-x 6 root root 4096 Jan 30 20:40 home
drwxr-xr-x 11 root root 4096 Mar 27 2007 lib
drwx------ 2 root root 16384 Aug 20 2006 lost+found
drwxr-xr-x 4 root root 4096 Oct 23 22:21 media
drwxr-xr-x 2 root root 0 Oct 23 22:21 misc
drwxr-xr-x 5 root root 4096 Jan 7 2007 mnt
drwxr-xr-x 2 root root 0 Oct 23 22:21 net
drwxr-xr-x 2 root root 4096 May 23 2005 opt
dr-xr-xr-x 99 root root 0 Oct 24 06:20 proc
drwxr-x--- 17 root root 4096 Mar 2 21:44 root
drwxr-xr-x 2 root root 12288 Mar 27 2007 sbin
drwxr-xr-x 2 root root 4096 Aug 19 2006 selinux
drwxr-xr-x 2 root root 4096 May 23 2005 srv
drwxr-xr-x 10 root root 0 Oct 24 06:20 sys
drwxrwxrwt 6 root root 4096 Mar 10 04:02 tmp
drwxr-xr-x 15 root root 4096 Aug 19 2006 usr
drwxr-xr-x 26 root root 4096 Aug 19 2006 var
>> rename testfile to current date and line count
[root@ganen test]# mv testfile `date +%m%d%Y`; wc -l `date +%m%d%Y`
22 03102008
Is that something you want?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I want to get the line count of the file from the 2nd line of the file ? The first line is header so want to skip that.
Thanks. (8 Replies)
Discussion started by: smc3
8 Replies
2. Shell Programming and Scripting
File.jpg
I want to copy and rename this as 2008-12-02.jpg
I tried this copy File.jpg date '%y-%m-%d-%H:%M:%S'.jpg
This doesnt work.... what do i do? (1 Reply)
Discussion started by: hdogg
1 Replies
3. Shell Programming and Scripting
Hi all,
in BIN/SH I need to group and count files by date.
Ie:
ls -la
-rw-r--r-- 1 aaa dba 122 Jul 13 14:28 as1.tmp
-rw-r--r-- 1 aaa dba 122 Jul 13 15:27 as2.tmp
-rw-r--r-- 1 aaa dba 122 Jul 21 17:04 as3.tmp
-rw-r--r-- 1 aaa dba 122 Jul 23 15:45 as4.tmp
-rw-r--r-- 1 aaa... (8 Replies)
Discussion started by: ric79
8 Replies
4. Shell Programming and Scripting
I am trying to rename files based on the created/born date of the file. I Have a total of 4000 files that i am trying to do this with and would like it to be log_yyyymmddhh.gz right now the files are maillog.???.gz.
Can anyone point me in the right direction of how to get this done via scipt?
... (4 Replies)
Discussion started by: Paulb
4 Replies
5. Shell Programming and Scripting
Hi!
Please see our current script:
#!/usr/bin/ksh
if (egrep "This string is found in the log" /a01/bpm.log)
then
mailx -s "Error from log" me@email.com, him@email.com </a01/bpm.log
fi
To the above existing script, we need to add the following change:
1) After finding the string,... (7 Replies)
Discussion started by: atechcorp
7 Replies
6. Shell Programming and Scripting
All,
I wanted to copy the files
From:
Daily_XYZ_TEST_1.csv
Daily_XYZ_TEST_2.csv
Daily_XYZ_TEST_3.csv
Daily_XYZ_TEST_4.csv
To:
Daily_ABC_TEST_1.csv
Daily_ABC_TEST_2.csv
Daily_ABC_TEST_3.csv
Daily_ABC_TEST_4.csv
I have tried the rename command but it is not working (5 Replies)
Discussion started by: alfredo123
5 Replies
7. UNIX for Advanced & Expert Users
hello,
can someone please suggest a script to rename a file that was generated today and filename that being generated daily starts with date, its a xml file.
here is example.
# find . -type f -mtime -1
./20130529_4995733057260357019.xml
#
this finename should be renamed to this format.... (6 Replies)
Discussion started by: bobby320
6 Replies
8. Shell Programming and Scripting
I'm trying to create a bash function that will allow me to rename a file name emails.txt to last monday's date
renem ()
{
d=`date -d last-monday`
mv ~/emails.txt ~/myemails/$d
}
but i en up wit this error any suggestion
mv: target `2014' is not a directory (3 Replies)
Discussion started by: robshal
3 Replies
9. Shell Programming and Scripting
Hi all,
could any provide me a solution for the below requirement.
I have two files namely abc.log.1 and abc.log.2
The above files have time stamp as Dec 08 and Dec 09
I need to rename the files as abc.log.1_20141208 and abc.log.2_20141209 and move to another bkp directory.
Thanks in... (2 Replies)
Discussion started by: bhaskar t
2 Replies
10. UNIX for Dummies Questions & Answers
Have a file in this format This is line one ; line_one
This is line two ; line_two
This is line three ; line_three
This is line four ; line four. I'm trying to make each line a new file called line_one
line_two
line_three
line_four. Tried using split -1 but then I'm back needing to rename... (3 Replies)
Discussion started by: jimmyf
3 Replies
LEARN ABOUT SUNOS
systemd-volatile-root.service
SYSTEMD-VOLATILE-ROOT.SERVICE(8) systemd-volatile-root.service SYSTEMD-VOLATILE-ROOT.SERVICE(8)
NAME
systemd-volatile-root.service, systemd-volatile-root - Make the root file system volatile
SYNOPSIS
systemd-volatile-root.service
/lib/systemd/systemd-volatile-root
DESCRIPTION
systemd-volatile-root.service is a service that replaces the root directory with a volatile memory file system ("tmpfs"), mounting the
original (non-volatile) /usr inside it read-only. This way, vendor data from /usr is available as usual, but all configuration data in
/etc, all state data in /var and all other resources stored directly under the root directory are reset on boot and lost at shutdown,
enabling fully stateless systems.
This service is only enabled if full volatile mode is selected, for example by specifying "systemd.volatile=yes" on the kernel command
line. This service runs only in the initial RAM disk ("initrd"), before the system transitions to the host's root directory. Note that this
service is not used if "systemd.volatile=state" is used, as in that mode the root directory is non-volatile.
SEE ALSO
systemd(1), systemd-fstab-generator(8), kernel-command-line(7)
systemd 237 SYSTEMD-VOLATILE-ROOT.SERVICE(8)