Welcome, Guest. Please login or register.
+  Linux Soft Forum
|-+  Cercetează» Întrebări de bază» rename files
[Picture 161] [Picture 160] [Picture 159]
Username:
Password:
 
Pages: 1 [2]   Go Down
  Print  
Author Topic: rename files  (Read 4200 times)
0 Members and 1 Guest are viewing this topic.
ioask4it
Membru
*

« Reply #15 on: March 22, 2009, 07:13:03 PM »

si ca sa va ingreunez situatia mai mult:
1. sa nu faca find asupra directorului curent (ca sa modificati sed -e 's/.\///' )
2. sa nu puneti data de astazi ci data fisierului (`date "+%Y%m%d%H%M%S"`)

Acuma, se mai poate face totul dintr-o... linie?
Sau tot ca mine, mai sus, precum programarea in C?
:d Ranjeste fasolea
Logged
oblio
Admini
**


WWW
« Reply #16 on: March 22, 2009, 07:22:46 PM »

Ia vezi, te ajuta:
Quote from: man find
-wholename pattern
         File name matches shell pattern pattern.   The metacharacters  do
         not treat `/' or `.' specially; so, for example,
         find . -wholename './sr*sc'
         will  print an entry for a directory called './src/misc' (if one
         exists).   To ignore a whole directory tree,  use   -prune   rather
         than  checking every file in the tree.  For example, to skip the
         directory `src/emacs' and all files and  directories  under  it,
         and  print the names of the other files found, do something like
         this:
         find . -wholename './src/emacs' -prune -o -print
Quote from: man date
-r, --reference=FILE
         display the last modification time of FILE
Logged

Distribuţie: ubuntu | Localitate: Bucureşti | Vârstă: 24

Oh! Everything has a point, and if it doesn't, then there's a point to it.

Oblio's
ioask4it
Membru
*

« Reply #17 on: March 22, 2009, 07:35:15 PM »

mda... pe aia cu date nu o stiam
multam fain
Logged
~Empathy~
Veteran
**

Decadence is Bliss...


« Reply #18 on: March 23, 2009, 12:23:19 AM »

Cred ca poti sa bagi in sed-ul ala si tr-ul, merg mai multe operatii la aceeasi rulare.

Nu.

De la Open Group citire:
"The interfaces specified in this specification set do not permit the inclusion of a NUL character in an RE or in the string to be matched. If during the operation of a standard utility a NUL is included in the text designated to be matched, that NUL may designate the end of the text string for the purposes of matching."

Cu alte cuvinte nu ai cum să scrii regula aia folosind regular expressions, ergo sed(1).
« Last Edit: March 23, 2009, 12:27:00 AM by ~Empathy~ » Logged

oblio
Admini
**


WWW
« Reply #19 on: March 23, 2009, 09:48:52 AM »

Off topic: Regula aia se poate scrie foarte uşor cu regular expressions în alte limbaje de programare/cu alte utilitare, e o limitare a sed-ului clasic faptul că nu poţi scrie asta: s/\n/\0/ (http://www.linuxtopia.org/online_books/linux_tool_guides/the_sed_faq/sedfaq5_009.html). Nu ştiam chestia asta, cam naşpa Sad
« Last Edit: March 23, 2009, 09:49:44 AM by oblio » Logged

Distribuţie: ubuntu | Localitate: Bucureşti | Vârstă: 24

Oh! Everything has a point, and if it doesn't, then there's a point to it.

Oblio's
ioask4it
Membru
*

« Reply #20 on: March 23, 2009, 05:45:53 PM »

oricum eu am facut regular expression pe
/mnt/videos/ Smiley deoarece in el cautam cu find
si merge. acuma arata si el (codul) mai bine.
Multam mult de tot si scuze ca am "scurs" doua pagini de thread pt o mica chestie
Logged
Pages: 1 [2]   Go Up
  Print  
 
Jump to: