|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello everybody,
I need to concat the results of two distinct lists of file and make one unique list. Something like that: list1='ls .txt' list2='ls .xml' I would like to have list = list1 + list2 (and then use the elements of list) but i cannot find the right command to do that. Note that the list1 and list 2 are retrieved in different part of a code (otherwise i would use a unique command). Thanks! |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
J_Zanetti :
> Hello everybody, > > I need to concat the results of two distinct lists of file and make one > unique list. > Something like that: > > list1='ls .txt' > list2='ls .xml' > > I would like to have list = list1 + list2 (and then use the elements of > list) but i cannot find the right command to do that. > Note that the list1 and list 2 are retrieved in different part of a > code (otherwise i would use a unique command). Is echo $list1 $list2 | sort | unique OK? |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Bo Yang ha scritto:
> Is > echo $list1 $list2 | sort | unique > OK? It works ! thanks ![]() |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Bo Yang wrote:
> J_Zanetti : > >>Hello everybody, >> >>I need to concat the results of two distinct lists of file and make one >>unique list. >>Something like that: >> >>list1='ls .txt' >>list2='ls .xml' >> >>I would like to have list = list1 + list2 (and then use the elements of >>list) but i cannot find the right command to do that. >>Note that the list1 and list 2 are retrieved in different part of a >>code (otherwise i would use a unique command). > > > Is > echo $list1 $list2 | sort | unique > OK? a) quote your variables b) sort has a -u option Ed. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On 2006-12-01, J_Zanetti wrote:
> Hello everybody, > > I need to concat the results of two distinct lists of file and make one > unique list. > Something like that: > > list1='ls .txt' > list2='ls .xml' Do you mean: list1=`ls *.txt` list2=`ls *.xml` > I would like to have list = list1 + list2 (and then use the elements of > list) but i cannot find the right command to do that. > Note that the list1 and list 2 are retrieved in different part of a > code (otherwise i would use a unique command). list3="$list1 $list2" -- Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) ===== My code in this post, if any, assumes the POSIX locale ===== and is released under the GNU General Public Licence |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
Ed Morton
> Bo Yang wrote: >> J_Zanetti : >> >>> Hello everybody, >>> >>> I need to concat the results of two distinct lists of file and make one >>> unique list. >>> Something like that: >>> >>> list1='ls .txt' >>> list2='ls .xml' >>> >>> I would like to have list = list1 + list2 (and then use the elements of >>> list) but i cannot find the right command to do that. >>> Note that the list1 and list 2 are retrieved in different part of a >>> code (otherwise i would use a unique command). >> >> >> Is >> echo $list1 $list2 | sort | unique >> OK? > > a) quote your variables > b) sort has a -u option > > Ed. Thank you! |
|
![]() |
| Outils de la discussion | |
|
|