[opensuse] bash: Is [ a special character?
Hi grep [7a] somefile finds all lines containing an a or a 7. Quoting: "[7a]" gives the same. a's and 7's. I want to find [7a] Thanks, L x -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
* lynn <lynn@steve-ss.com> [07-08-12 12:50]:
grep [7a] somefile finds all lines containing an a or a 7. Quoting: "[7a]" gives the same. a's and 7's.
I want to find [7a]
grep \]7a\] -- (paka)Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 http://en.opensuse.org openSUSE Community Member Registered Linux User #207535 @ http://linuxcounter.net -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hello, On Sun, 08 Jul 2012, Patrick Shanahan wrote:
* lynn <lynn@steve-ss.com> [07-08-12 12:50]:
grep [7a] somefile finds all lines containing an a or a 7. Quoting: "[7a]" gives the same. a's and 7's.
I want to find [7a]
grep \]7a\]
*bzzzt* You'd need to use grep \\\[7a\\\] without quotes. Compare with e.g.: $ printf 'a\nb [7a] c\nd 7\n' | grep \[7a\] -dnh --
Open .profile with vi The vi looks at the .profile and says, "icky, I'm not opening that. Ask Emacs." -- Graham Reed, feeling adventuroush. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 08/07/12 19:28, David Haller wrote:
Hello,
On Sun, 08 Jul 2012, Patrick Shanahan wrote:
* lynn <lynn@steve-ss.com> [07-08-12 12:50]:
grep [7a] somefile finds all lines containing an a or a 7. Quoting: "[7a]" gives the same. a's and 7's.
I want to find [7a]
grep \]7a\]
*bzzzt* You'd need to use
grep \\\[7a\\\]
without quotes. Compare with e.g.:
$ printf 'a\nb [7a] c\nd 7\n' | grep \[7a\]
-dnh
Hi David Yeah, just tried it. The single quotes messes it up. This works with double quotes: grep "\[7a\]" /usr/local/samba/etc/smb.conf [7a] and so does yours without quotes: grep \\\[7a\\\] /usr/local/samba/etc/smb.conf [7a] Anything else seems to print either the whole of smb.conf or nothing. Thanks, L x -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hi, there is even a straighter way to get a particular share configuration from smb.conf testparm --section-name 7a You might also combine this with --parameter-name Thanks, Lars -- Lars Müller [ˈlaː(r)z ˈmʏlɐ] Samba Team + SUSE Labs SUSE Linux, Maxfeldstraße 5, 90409 Nürnberg, Germany
On 08/07/12 22:07, Lars Müller wrote:
Hi,
there is even a straighter way to get a particular share configuration from smb.conf
testparm --section-name 7a
You might also combine this with --parameter-name
Thanks,
Lars
OMG Thank you so much. testparm --section-name 7a Press enter to see a dump of your service definitions [7a] path = /home2/students/year7/7a read only = No Totally and utterly what we needed. Lars, whilst we are here, do we have any plans to include Samba4 into 12.2? It's an amazing achievement and one which is well suited to openSUSE. Ubuntu already have the beta2 packaged. Lets show them how to do it properly. samba -V Version 4.0.0beta4-GIT-a49eb60 L x -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Mon, Jul 09, 2012 at 12:32:03AM +0200, lynn wrote: [ 8< ]
testparm --section-name 7a
you might need to combine it with -s too.
Lars, whilst we are here, do we have any plans to include Samba4 into 12.2?
12.2 will not get it. 12.2 will get 3.6.6. Samba 4.0.0 is at a beta stage at the moment. Therefore we're trying to build it as part of the network:samba:TESTING project as we do since ages.
It's an amazing achievement and one which is well suited to openSUSE. Ubuntu already have the beta2 packaged. Lets show them how to do it properly.
We're happy to see submit requests to network:samba:TESTING. Till now we unfortunately haven't seen a lot. Thanks, Lars -- Lars Müller [ˈlaː(r)z ˈmʏlɐ] Samba Team + SUSE Labs SUSE Linux, Maxfeldstraße 5, 90409 Nürnberg, Germany
On 09/07/12 07:56, Lars Müller wrote:
On Mon, Jul 09, 2012 at 12:32:03AM +0200, lynn wrote:
It's an amazing achievement and one which is well suited to openSUSE. Ubuntu already have the beta2 packaged. Lets show them how to do it properly.
We're happy to see submit requests to network:samba:TESTING. Till now we unfortunately haven't seen a lot.
How do I submit a request to 'network:samba:TESTING'? We have a test LAN and do nightly git builds. The only problem we see for end users is the provisioning. Maybe Yast>Samba server could handle it? L x -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Mon, Jul 09, 2012 at 09:59:49AM +0200, lynn wrote:
On 09/07/12 07:56, Lars Müller wrote:
On Mon, Jul 09, 2012 at 12:32:03AM +0200, lynn wrote:
It's an amazing achievement and one which is well suited to openSUSE. Ubuntu already have the beta2 packaged. Lets show them how to do it properly.
We're happy to see submit requests to network:samba:TESTING. Till now we unfortunately haven't seen a lot.
How do I submit a request to 'network:samba:TESTING'?
See http://en.openSUSE.org/openSUSE:Build_Service_Collaboration about how the Build Service Collaboration is expected to work.
We have a test LAN and do nightly git builds. The only problem we see for end users is the provisioning. Maybe Yast>Samba server could handle it?
Yes. Here bugzilla is the tool to track such issues. Be this nice and report the ID back to this list. Preferred as clickable link. Thanks, Lars -- Lars Müller [ˈlaː(r)z ˈmʏlɐ] Samba Team + SUSE Labs SUSE Linux, Maxfeldstraße 5, 90409 Nürnberg, Germany
On 09/07/12 10:23, Lars Müller wrote:
On Mon, Jul 09, 2012 at 09:59:49AM +0200, lynn wrote:
On 09/07/12 07:56, Lars Müller wrote:
On Mon, Jul 09, 2012 at 12:32:03AM +0200, lynn wrote:
We have a test LAN and do nightly git builds. The only problem we see for end users is the provisioning. Maybe Yast>Samba server could handle it?
Yes. Here bugzilla is the tool to track such issues.
Be this nice and report the ID back to this list. Preferred as clickable link.
Thanks,
Lars
Hi I have been nice:-) https://bugzilla.novell.com/show_bug.cgi?id=770390 L x -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hello, YES! RTFM. Section "Pathname Expansion" (aka globbing): [..] [...] Matches any one of the enclosed characters. [..] There's also other places where [ has a special meaning, esp. as an alias for the 'test' builtin. On Sun, 08 Jul 2012, lynn wrote:
grep [7a] somefile finds all lines containing an a or a 7. Quoting: "[7a]" gives the same. a's and 7's.
I want to find [7a]
RTFM: man 7 regex [ has a special meaning for grep _as well_! You'll need to use grep '\[7a\]' file with the '' to stop the shell expanding the [], and the '\' to escape them in the regex. You should find stuff like this in any decent shell-intro. -dnh -- "Humans need fantasy .. to *be* human" -- Death (in Hogfather) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 08/07/12 19:11, David Haller wrote:
Hello,
grep '\[7a\]' file
Sorry guys. I may have got the \'s after an hour or so but the single quotes would have, ahem, escaped me. Anyway, you have saved me countless hours of the FM. Thanks, L x -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hello, On Sun, 08 Jul 2012, lynn wrote:
On 08/07/12 19:11, David Haller wrote:
grep '\[7a\]' file
Sorry guys. I may have got the \'s after an hour or so but the single quotes would have, ahem, escaped me.
Anyway, you have saved me countless hours of the FM.
There are a few simple rules in shell-programming, first and IMO by far the most important: * quote! With '' unless you _need_ to have something to expand inside, with "" in other cases. If in doubt, mix quoting: prog 'foo'"$bar"'baz' * use 'set -x' to see _how_ a program is actually called. Case in point: $ set -x $ grep [7a] /dev/null + grep '[7a]' /dev/null $ grep \[7a\] /dev/null + grep '[7a]' /dev/null ==== Excursion! ==== BTW: above is only because there's no matching files in the current directory. $ touch a 7 + touch a 7 $ grep [7a] /dev/null + grep 7 a /dev/null ### this is NOT what you want, eh? ### grep for '7' in files 'a' and /dev/null. $ grep \[7a\] /dev/null + grep '[7a]' /dev/null ### this is ;) But quoting is easier ### and more robust. $ rm a 7 Understand this "excursion"! It's quite important to understand in respect to why quoting is so important. ==== $ grep '[7a]' /dev/null + grep '[7a]' /dev/null $ grep '\[7a\]' /dev/null + grep '\[7a\]' /dev/null $ grep \\\[7a\\\] /dev/null + grep '\[7a\]' /dev/null $ Now, once you've figured that out, how the shell calls grep, you'll need to look at 'man 7 regex' to find out what you need to use for grep to do what you want ;) The cases where you can't quote at all are _very_ rare and far between and use those only when you know exactly what and _why_ you're doing. Read up on "special characters" in the shell though. And for grep, you _will_ need to know the regexp special characters, man 7 regex is a bit harsh an entry, but there's plenty of "nice" regex introductions on the web (I'd guess the Wikipedia links to at least one ;). Also, try digging through this lists archive, articles by me containing a keyword like "quote", "quoting", "regex", "bash", often also answering "Carlos" should yield some results. See http://lists.opensuse.org or use google with "site:lists.opensuse.org" for a different search engine. Feel free to ask more, but preferably you should do that on opensuse-programming. HTH, -dnh -- Do you have feelings of inadequacy? Do you suffer from shyness? Do you sometimes wish you were more assertive? If you answered "yes" to any of these questions, ask your doctor or pharmacist about Tequila. -- asr -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 07/08/2012 07:48 PM, lynn wrote:
Hi grep [7a] somefile finds all lines containing an a or a 7. Quoting: "[7a]" gives the same. a's and 7's.
I want to find [7a]
Thanks, L x Yes, [] specifies classes of symbols. Use \[ and \]
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJP+cvaAAoJEKWTiqSclQac17gH/Rthg3ueU3Nbdb32l0xbwCWH lqnJg3cuUfk7+9fYEap6rEgjQRlVMj6nJlDlwfsWlOMR2PRGx2inDrWJ0cBgm/8t HAHTCstcLE0Jyxkl1ip1ICkdMEQd56OlYu24s91Zi7pSTVlhK7Ht7u5xil/e7iNc WWw98RI4RCGOm2anCspuAQnWkzpb9oHwH2ZQPEFHfUAwjKsYuierfmyCCcWoU1mz gL5P6yxOugeeJH6shuGmIWXmX3pzZB7L+oz2VfZkZRrpNHtwLqX4hsNnJbXLzBvJ fblO9nnyWrQSJf+bdPvCIf4w+Ynnd8F4ZszrPo4ybfR9bfZPXnLYEnEQdsk3f5U= =d5zG -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (5)
-
David Haller
-
Lars Müller
-
lynn
-
Mark Goldstein
-
Patrick Shanahan