![]() |
|
|
|||||||
| Home | Forums | Register | Rules & FAQ | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
Other UNIX.COM Threads You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| insert escape charactor within VIM | cin2000 | Shell Programming and Scripting | 2 | 03-23-2006 08:46 AM |
| how to pick out last charactor of a string? | cin2000 | Shell Programming and Scripting | 7 | 12-22-2005 11:51 AM |
| Search with awk, but having space within | videsh77 | Shell Programming and Scripting | 1 | 01-27-2005 08:03 AM |
| swap space / paging space | aaronh | AIX | 2 | 05-19-2004 07:06 AM |
| pageing space vs swap space | VeroL | UNIX for Dummies Questions & Answers | 1 | 01-22-2004 07:54 AM |
![]() |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
search from specified charactor space
Hello, I'm quite a noobie in programming in UNIX
and I was wondering if it is possible to use 'grep' or similar method to find PATTERNS from designated location (of charactor) for example |param 1 ||param2 | andrew kim josh daniel kim michelle michelle andrew kim I hope to be able to search up kim and display only the first 2 lines not the 3rd i know that cut has -c1-10 so you can specify charactor to cut but can the grep or other things be done the same? and display the whole line? thank you very much regards |
| Forum Sponsor | ||
|
|
|
|||
|
Hello Smiling Dragon
Thanks for the post sorry but what is /dev/null? and REALLY sorry but i have a small problem when i do read by line my ' '(space x 10) is same as ' ' (space x1) is there a way to keep the spaces as it is while reading line by line? thanks (this is important because i cannot use delim as some are like JenniferKim 2 params are stuck together) Last edited by akmix : 01-30-2008 at 05:07 PM. |
|
||||
|
I think I follow what you mean...
If you need something to appear in the forums as you've typed it, surround it with CODE tags (the "#" symbol in the editor). /dev/null is just a garbage can, it means that I want the output from grep to go nowhere as we don't need it. You can get a similar effect by using grep with the -q option but that only wroks on certain versions of grep. If your fields are exactly 8 chars wide, we can change the cut call in the code like so: Code:
cut -d ' ' -f 1,2 Code:
cut -c 1-16 |
|
|||
|
oh, thank you
well my code is exactly certain character wide but when i use read line by line method it seems to shrink it down so if i type cat emplist Andrew Kim..........Daniel Kim Henry Kim..........Danny Kim Daniel Taegyun tk KimAndrew Kim but read line then echo'ing it gives me Andrew Kim.Daniel Kim Henry Kim.Danny Kim Daniel Taegyun tk KimAndrew Kim is there -(something) statement that preserves the # #? sorry my question is starting to go really long.. and I've replaced (space) with . thanks ps. i'v tried # #? and # # is same as # #? regards |
|||
| Google UNIX.COM |