Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi N - Z > Sistemi operativi I > comando cut
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
Laüra
.simpatizzante.

User info:
Registered: Dec 2004
Posts: 14 (0.00 al dì)
Location:
Corso: Informatica
Anno: 3
Time Online: 13:03:02: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
comando cut

Ciao a tutti!

Non riesco ad usare il comando cut con ls..... ho fatto varie prove ma l'output rimane sempre lo stesso...qualcuno sa spiegarmi cosa sbaglio?

Per esempio:
se faccio du -s /usr/bin | cut -f 1 ottengo il risultato atteso

ma se faccio ls -l /usr/bin | cut -f 4 l'output di ls non cambia.

Grazie

17-07-2007 11:05
Click Here to See the Profile for Laüra Click here to Send Laüra a Private Message Find more posts by Laüra Add Laüra to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
n3o
tanto c'è SPASS...

User info:
Registered: Oct 2005
Posts: 134 (0.02 al dì)
Location: Brescia
Corso: Informatica Magistrale
Anno:
Time Online: 1 Day, 19:26:05: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ls -l /usr/bin | tr -s ' ' ' ' | cut -d ' ' -f 4

Di norma cut prende come separatori i blank (in du le colonne sono separate da tab, quindi tutto ok)
In ls -l purtroppo i campi sono separati da spazi ma in un numero variabile non predicibile a priori, quindi l'unico modo è applicare all'output tr -s ' ' ' ' che comprime tutti gli spazi contigui in un solo spazio e poi cut -d ' ' - f 4 che estrae la quarta colonna specificando il separatore come spazio.

Giusto per capire meglio tr, funziona anche:
ls -l /usr/bin | tr -s ' ' ':' | cut -d ':' -f 4
o qualsiasi carattere sostitutivo degli spazi contigui

Prova i comandi passo passo e consulta i manuali per capire bene le opzioni!

__________________
The answer is blowing in the wind...

18-07-2007 14:49
Click Here to See the Profile for n3o Click here to Send n3o a Private Message Find more posts by n3o Add n3o to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 16:12.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.142 seconds (31.05% PHP - 68.95% MySQL) con 25 query.