![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Career Guidance | sufi_431 | What's on Your Mind? | 1 | 10-23-2007 11:54 AM |
| NIM Guidance | scottsl | AIX | 1 | 06-12-2006 12:18 PM |
| Sed help needed | stevefox | Shell Programming and Scripting | 5 | 12-05-2005 01:44 AM |
| Looking for guidance in obtaining a job in Unix Administration | pkali290 | SCO | 4 | 12-09-2003 03:51 AM |
| select in ksh, any guidance for bash? | Shakey21 | UNIX for Dummies Questions & Answers | 1 | 05-09-2002 01:40 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
A little guidance needed :)
Hi guys, I'm learning the ropes of BASH and am doing a few exercises to see if its sinking in but have gotten stuck on something I KNOW is looking at me right in the face but just isn't registering.
I'm creating a script that needs to get specific strings from a line. So using the "ls -l <filename>" command, i get a string with 6 fields (permissions and so forth). No i know there is a way to get an individual field from the 6 fields and store it but i just cant remember it. I believe its a pipe to the grep command but I'm unsure and for all i know there is an easier method. Any help would be appreciated! Code: str = $(ls -l <filename>) #To get the info now i just need to "split" the data - if it was perl, easy enough :P. Edit: No AWK or SED. |
|
||||
|
Indeed you could call it something like that.. Still if I'm not going to get anywhere sitting around and fiddling about then i may as well ask. Otherwise im not learning anything .. just wasting a bit of time.
Cheers non the less! Code str=$(ls -l <filename> | cut -d ' ' -f 1) -d Delimiter (space in my case) -f fields (1st one in my case) Just a brief explanation if someone was stuck on a similar situation. Last edited by shadow0001; 03-07-2008 at 11:35 AM.. |
|
||||
|
I tried that however it did not work - brought up the entire line with out the option. Unix doesn't like me very much lol.
A final (i hope) question. If i had the work "command" and i wanted to split it into characters, how would i go about doing this ? See i need to be able to process each character individually using a loop however i am not aware of a command that allows me to do this. Thanks again. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|