Thursday, March 24, 2016

RHEL - playing with files and dir

[jay@sama test]$ echo today is `date +%w`
today is 5
[jay@sama test]$ echo today is `date +%A`
today is Friday
[jay@sama test]$ touch {file1 file2, file3,file4}.log
[jay@sama test]$ ls -ltr
total 16
-rw-r--r--. 1 jay testing 15751 Mar 11 17:38 myetc.txt
-rw-r--r--. 1 jay testing     0 Mar 11 17:54 {file1
-rw-r--r--. 1 jay testing     0 Mar 11 17:54 file3,file4}.log
-rw-r--r--. 1 jay testing     0 Mar 11 17:54 file2,
[jay@sama test]$ echo {file1 file2, file3,file4}.log
{file1 file2, file3,file4}.log
[jay@sama test]$ echo {file1_file2,file3,file4}.log
file1_file2.log file3.log file4.log
[jay@sama test]$ rm {file1 file2, file3,file4}.log
[jay@sama test]$ ls -ltr
total 16
-rw-r--r--. 1 jay testing 15751 Mar 11 17:38 myetc.txt
[jay@sama test]$ touch {file1_file2,file3,file4}.log
[jay@sama test]$ ls -ltr
total 16
-rw-r--r--. 1 jay testing 15751 Mar 11 17:38 myetc.txt
-rw-r--r--. 1 jay testing     0 Mar 11 17:56 file4.log
-rw-r--r--. 1 jay testing     0 Mar 11 17:56 file3.log
-rw-r--r--. 1 jay testing     0 Mar 11 17:56 file1_file2.log
[jay@sama test]$ rm {file1_file2,file3,file4}.log
[jay@sama test]$ ls -ltr
total 16
-rw-r--r--. 1 jay testing 15751 Mar 11 17:38 myetc.txt
[jay@sama test]$ echo file{1..3}.log
file1.log file2.log file3.log
[jay@sama test]$ echo file{1..5}.log
file1.log file2.log file3.log file4.log file5.log
[jay@sama test]$ echo file{a..g)(1..6)
-bash: syntax error near unexpected token `)'
[jay@sama test]$ echo file{a..g}{1..6}
filea1 filea2 filea3 filea4 filea5 filea6 fileb1 fileb2 fileb3 fileb4 fileb5 fileb6 filec1 filec2 filec3 filec4 filec5 filec6 filed1 filed2 filed3 filed4 filed5 filed6 filee1 filee2 filee3 filee4 filee5 filee6 filef1 filef2 filef3 filef4 filef5 filef6 fileg1 fileg2 fileg3 fileg4 fileg5 fileg6
[jay@sama test]$

[jay@sama test]$ echo file{a,b}{1,2}.txt
filea1.txt filea2.txt fileb1.txt fileb2.txt
[jay@sama test]$



[jay@sama test]$ echo file{a,b}{1,2}.txt
filea1.txt filea2.txt fileb1.txt fileb2.txt

[jay@sama test]$  echo file{x{1,3},y,z}.txt
filex1.txt filex3.txt filey.txt filez.txt
[jay@sama test]$

No comments:

Post a Comment