![]() |
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 |
| 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 |
| List certain file in a folder and make list | andrisetia | UNIX for Dummies Questions & Answers | 1 | 09-15-2008 01:21 PM |
| Export a file system with write permissions | jredx | Filesystems, Disks and Memory | 7 | 05-27-2008 03:05 AM |
| Is it possible to re-export a exported NFS file system? | Adams Nave | Filesystems, Disks and Memory | 5 | 03-15-2008 01:40 AM |
| Failed to export parameters from configuration file | nir_s | Shell Programming and Scripting | 5 | 01-16-2006 03:03 AM |
| How to export data file from Unix | whatisthis | UNIX for Dummies Questions & Answers | 20 | 03-03-2005 02:16 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
list and export strings in a file
Hi all,
I have a file looks something like this: ~~~~~~~~~~~~~~~~~~~~~~~~~ aaaa bbbbbb ccc dddddddd ~~~~~~~~~~~~~~~~~~~~~~~~~ I will like a script that can echo line1 export line1 as env variable echo line2 export line2 as env variable etc etc Thanks in advance |
|
||||
|
Hi Zaxxon,
Thanks for the fast response... It will be fine if I can set it as a variable in a file, but what I'm after is the following: Say I have a text file named file.text that has the following entries: aaaa bbb cc d What I want to do is to list them as a menu in format: 1) aaaa 2) bbb 3) cc 4) d and at the same time set them as variables sid1 = aaaa sid2 = bbb etc etc Can you please help with this, I have the following but it doesn't work like I want it to. num = 'cat file.txt | wc -l' for ELE in `grep -v "^~" file.txt` do for (( i = 0; i < num; i++)) do echo "$i) ${ELE}" sid $i="${ELE}" done done The output from this gives: 1) aaaa 1) bbb and doesn't set the variables correctly either. Thanks in advance |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|