![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell Script Required? Pls. help me | ntgobinath | Shell Programming and Scripting | 22 | 05-29-2008 07:09 AM |
| Shell Script Required | ntgobinath | Shell Programming and Scripting | 3 | 05-06-2008 01:04 PM |
| Shell Script Required! | vats | Shell Programming and Scripting | 3 | 08-28-2007 02:29 AM |
| C programming - Urgent help required | kkumar1975 | High Level Programming | 2 | 04-08-2002 07:36 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
I have a file named "file1" with contents as shown below:
name(abc) age(123) empid(a123) degree(graduate) . . . . Now suppose I know that the format of my file is as above but I don't know the contents within () ie. as if the file to me is like this name(???), age(???) etc. How do I extract the contents within () and store it in a variable? Please help me if possible with a sample code! |
|
||||
|
hey manas,
I didn't understand why the while loop is required? I tried the following way. It isn't giving any error but no outputs also ![]() x=`nawk -F 'NR == 1 {print $1}' | sed 's/^.*(\(.*\))/\1/'` echo "$x" The nawk part is working. I have checked it with echo command. So the input to sed is something like name(abc). Can you please clarify where I am going wrong? |
|
||||
|
Quote:
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|