Unix C++
Would you like to react to this message? Create an account in a few clicks or log in to continue.

dbt in syntax

+4
akalya
Vineet_More
Christopher
SakeenaHarris
8 posters

Page 1 of 2 1, 2  Next

Go down

dbt in syntax Empty dbt in syntax

Post by SakeenaHarris Thu Mar 11, 2010 4:07 pm

cat list2
grapes
prunes
dates
almonds
[@oracleclient ~]$ cat list1
mango
orange
pineapple
lemons
[@oracleclient ~]$ cat list[^12]
mango
orange
pineapple
lemons
grapes
prunes
dates
almondslemons
grapes
prunes
dates
almond
#what does it print, i.e; the cat list[^12]

SakeenaHarris

Posts : 7
Points : 13
Join date : 2010-03-08

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by Christopher Thu Mar 11, 2010 4:12 pm

list[^12] points to files named ("list"+any one of the characters enclosed in brackets).
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by Vineet_More Thu Mar 11, 2010 4:42 pm

Christopher Can you please explain in more detailed fashion??

Vineet_More

Posts : 27
Points : 31
Join date : 2010-02-26

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by Christopher Thu Mar 11, 2010 4:50 pm

it takes all the possible combinations as arguments.

for example,
abc[def] refers to all the files starts with "abc" and fourth character is any one of the character enclosed in square bracket.

Code:
cat abc[def] ==> cat abcd abce abcf
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

dbt in syntax Empty dbt in syntax

Post by SakeenaHarris Thu Mar 11, 2010 5:01 pm

but its displaying both the lists list1 and list2 along with list2 again...... Crying or Very sad

SakeenaHarris

Posts : 7
Points : 13
Join date : 2010-03-08

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by Christopher Thu Mar 11, 2010 5:16 pm

tats how it works
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by akalya Thu Mar 11, 2010 5:45 pm

does cat list[^12] work????

i'm getting as....
[335802@oracleclient ~]$ cat list[^210]
cat: list[^210]: No such file or directory

but if i give
[335802@oracleclient ~]$ cat list["^210"]
hello
me
hi
everybody
mango
orange
pineapple
lemons
grapes
prunes
dates
almonds

contents of the files list0 list1 list2 are printed in order...(ie always list0 first followed by list1 and list2)

akalya

Posts : 70
Points : 86
Join date : 2010-03-04

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by jeeva Thu Mar 11, 2010 5:58 pm

m gettin this

[335814@oracleclient ~]$ cat >list1
this s list 1
hi
hello
where are you

[335814@oracleclient ~]$ cat >list2
this is list 2
apple
orange
grapes

[335814@oracleclient ~]$ cat >list3
this is list 3
potato
beans
peas

[335814@oracleclient ~]$ cat list[^12]
this is list 3
potato
beans
peas
[335814@oracleclient ~]$ cat list[^13]
this is list 2
apple
orange
grapes
[335814@oracleclient ~]$ cat list[^23]
this s list 1
hi
hello
where are you

jeeva

Posts : 50
Points : 93
Join date : 2010-03-04

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by jeeva Thu Mar 11, 2010 6:00 pm

hey i got somethin...

for the same above lists

[335814@oracleclient ~]$ cat list["^23"]
this is list 2
apple
orange
grapes
this is list 3
potato
beans
peas

jeeva

Posts : 50
Points : 93
Join date : 2010-03-04

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by akalya Thu Mar 11, 2010 6:05 pm

ya i agree with jeeva.....
list[^12]
here ^ does the work of negation....prints all files named list(followed by single alphabet or number like list0 or listA) except list 1 and list2
while list["^12"]
displays contents of the file list1 and list2


Last edited by akalya on Thu Mar 11, 2010 6:10 pm; edited 1 time in total

akalya

Posts : 70
Points : 86
Join date : 2010-03-04

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by Christopher Thu Mar 11, 2010 6:06 pm

sorry. i didn't read the question properly. if u give list[^12], it means tat "list+(any one character other than 1 and 2)"
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by Christopher Thu Mar 11, 2010 6:08 pm

@akalya
list["^12"] displays contents of file list1, list2 and also list^.
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by jeeva Thu Mar 11, 2010 6:09 pm

ya akalya i think that negation is not necessary inside " "... i tried

jeeva

Posts : 50
Points : 93
Join date : 2010-03-04

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by akalya Thu Mar 11, 2010 6:16 pm

@christopher and @jeeva
yup...u ppl are rite...

akalya

Posts : 70
Points : 86
Join date : 2010-03-04

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by akalya Thu Mar 11, 2010 6:17 pm

consider i have the files list1,list2 and list12 .....how i display the contents of al these files appended

akalya

Posts : 70
Points : 86
Join date : 2010-03-04

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by Maithreyi Thu Mar 11, 2010 6:23 pm

Display it where ? On the console ?

Won't cat list1 list2 list12 do that ?

Maithreyi

Posts : 76
Points : 142
Join date : 2010-03-03
Age : 36
Location : Haldia

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by akalya Thu Mar 11, 2010 6:29 pm

cat list1 list2 ---->cat list[12]
i was trying to find similar equivalent one for cat list1 list2 list12....
this works
cat list[12][2]--->list12 and list22
cat list[12][21]---->list12,list21,list11,list22

akalya

Posts : 70
Points : 86
Join date : 2010-03-04

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by jeeva Thu Mar 11, 2010 6:31 pm

but in this case list1 and list2 are not comin na...!!

jeeva

Posts : 50
Points : 93
Join date : 2010-03-04

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by akalya Thu Mar 11, 2010 6:36 pm

yup
list1 and list2 not displayed
Sad

akalya

Posts : 70
Points : 86
Join date : 2010-03-04

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by Christopher Thu Mar 11, 2010 6:37 pm

this is a easy way to do this.
Code:
$ cat list[12] list[12][12]

this displays list1, list2, list11, list12, list21, list22.
i guess u want to do this by passing single argument.
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by jeeva Thu Mar 11, 2010 6:43 pm

yes

jeeva

Posts : 50
Points : 93
Join date : 2010-03-04

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by akalya Thu Mar 11, 2010 6:44 pm

yup...
something like list[12] should return files list1,list2,list12,list21

akalya

Posts : 70
Points : 86
Join date : 2010-03-04

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by urvershi Thu Mar 11, 2010 6:51 pm

try dis
cat list[12]*

urvershi

Posts : 21
Points : 70
Join date : 2010-02-26

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by Christopher Thu Mar 11, 2010 6:53 pm

it ll work. but it ll display all the files including list1a,list13,list1A,etc.
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by jeeva Thu Mar 11, 2010 6:54 pm

hey that works Smile

jeeva

Posts : 50
Points : 93
Join date : 2010-03-04

Back to top Go down

dbt in syntax Empty Re: dbt in syntax

Post by Sponsored content


Sponsored content


Back to top Go down

Page 1 of 2 1, 2  Next

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum