LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Programming question (https://www.linuxquestions.org/questions/linux-newbie-8/programming-question-36987/)

pk21 12-01-2002 02:49 PM

Programming question
 
Can anyone tell me how i can get the string -rw-r--r-- to be seperated in -, rw-, r-- and r--?

I think i have to use sed but am not sure :(

Help would be appreciated.

Tinkster 12-01-2002 03:14 PM

Gidday!

Firstly, there's a programming forum ...

Secondly, what language are you using? :}

Cheers,
Tink

pk21 12-01-2002 03:17 PM

i know there is a programming forum, but i thought that this would be a very newbie question so thats why i am posting here.

And im using bash

Tinkster 12-01-2002 06:18 PM

Hello again ...

I wouldn't know of any stringhandling commands
built into bash, but you could filter the output of
your ls through the colrm-command, or sed
(or use Perl instead of bash-scripting ;})

for instance like that ...
ls -l | colrm 11 | colrm 1 7 will give you the perms for o
ls -l | colrm 8 | colrm 1 4 will give you the perms for g
ls -l | colrm 5 | colrm 1 1 will give you the perms for u
ls -l | colrm 2 will give you directory flag

HIH

Cheers,
Tink

acid_kewpie 12-01-2002 06:21 PM

pk21 you have had over two hundred posts... you know fully well that you shouldn't double post. wether your original one is in the wrong forum or not is irrelevant...

http://www.linuxquestions.org/questi...threadid=36990

pk21 12-02-2002 12:05 PM

damn, hoped no one would notice :rolleyes:

wont happen again.

And thanks for all the help guys!

Ciccio 12-02-2002 01:17 PM

I think that the thread can be moved from a one forum to another... Anyway, what comes to bash programming I'm still a newbie... (newbier than you apparently :p)

Save the penguin :Pengy:


All times are GMT -5. The time now is 03:19 PM.