[opensuse] cli find cmd syntax
Hi, I am endeavouring to print a list of my Maildir folders to a file so that I can use that same list when I construct a Procmailrc file. Initially I ran ~> find $HOME/Maildir -type d -print | sort > /home/hylton/maillistdir **sample snip*** /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/courierimapkeywords /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/cur /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/new /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/tmp ******** I noticed that there were many sub-folders I did not need. Given this list ended up being 273pg, after a short stint at editing it I decided there had to be a way to exclude certain folders. What I need is the namesand paths of the folders ie /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari , not the /cur, /tmp, /new or even the /courierimapkeywords sub-folders. So far I have: ~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir The above command returns a 'Command not found' in my destination file of maillistdir. I have RTFM'd, Googled and still cannot find an example of what I want to do. I even visited the sites Aaron Digulla gave me on an earlier pointing to the complexities of find. Any more help appreciated Tnx Hylton -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 29-12-2014 17:42, Hylton Conacher (ZR1HPC) wrote:
Hi,
I am endeavouring to print a list of my Maildir folders to a file so that I can use that same list when I construct a Procmailrc file.
Initially I ran ~> find $HOME/Maildir -type d -print | sort > /home/hylton/maillistdir
**sample snip*** /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/courierimapkeywords /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/cur /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/new /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/tmp ********
I noticed that there were many sub-folders I did not need. Given this list ended up being 273pg, after a short stint at editing it I decided there had to be a way to exclude certain folders.
What I need is the namesand paths of the folders ie /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari
, not the /cur, /tmp, /new or even the /courierimapkeywords sub-folders.
So far I have:
~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir
The above command returns a 'Command not found' in my destination file of maillistdir.
No, it says: '-print: command not found' ^^^^^^^^ maybe you should remove the '|' before '-print' ? ;-) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 29-12-2014 17:42, Hylton Conacher (ZR1HPC) wrote:
Hi,
I am endeavouring to print a list of my Maildir folders to a file so that I can use that same list when I construct a Procmailrc file.
Initially I ran ~> find $HOME/Maildir -type d -print | sort > /home/hylton/maillistdir
**sample snip*** /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/courierimapkeywords /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/cur /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/new /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/tmp ********
I noticed that there were many sub-folders I did not need. Given this list ended up being 273pg, after a short stint at editing it I decided there had to be a way to exclude certain folders.
What I need is the namesand paths of the folders ie /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari
, not the /cur, /tmp, /new or even the /courierimapkeywords sub-folders.
So far I have:
~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir
The above command returns a 'Command not found' in my destination file of maillistdir.
or try this: find $HOME/Maildir -type d | \ grep -v -e '/new' -e '/tmp' -e '/cur' | \ sort -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 29/12/14 18:55, Luuk wrote:
On 29-12-2014 17:42, Hylton Conacher (ZR1HPC) wrote:
Hi,
I am endeavouring to print a list of my Maildir folders to a file so that I can use that same list when I construct a Procmailrc file.
Initially I ran ~> find $HOME/Maildir -type d -print | sort > /home/hylton/maillistdir
**sample snip*** /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/courierimapkeywords /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/cur /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/new /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/tmp ********
I noticed that there were many sub-folders I did not need. Given this list ended up being 273pg, after a short stint at editing it I decided there had to be a way to exclude certain folders.
What I need is the namesand paths of the folders ie /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari
, not the /cur, /tmp, /new or even the /courierimapkeywords sub-folders.
So far I have:
~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir
The above command returns a 'Command not found' in my destination file of maillistdir.
or try this: find $HOME/Maildir -type d | \ grep -v -e '/new' -e '/tmp' -e '/cur' | \ sort OK BUT FYI,
Your command: :~> find $HOME/Maildir -type d | \grep -v -e `/new' -e /tmp' -e `/cur' -e `/courierimapkeywords' |\ sort > /home/hylton/maillistdir Resulted in this error: :~> bash: /new -e /tmp: No such file or directory HTH Hylton
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2014-12-30 16:49, Hylton Conacher (ZR1HPC) wrote:
OK BUT FYI,
Your command:
:~> find $HOME/Maildir -type d | \grep -v -e `/new' -e /tmp' -e `/cur' -e `/courierimapkeywords' |\ sort > /home/hylton/maillistdir
Resulted in this error:
:~> bash: /new -e /tmp: No such file or directory
Because you typed it wrong. Read again what the backslash means, it has been explained in another post in this thread. He told you to enter: find $HOME/Maildir -type d | \ grep -v -e '/new' -e '/tmp' -e '/cur' | \ sort NOT: find $HOME/Maildir -type d | \grep -v -e '/new' -e '/tmp' -e '/cur' |\ sort It is very different. If you put the command in a single line, you have to remove the backslashes. -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar)
On 30-12-2014 16:49, Hylton Conacher (ZR1HPC) wrote:
On 29/12/14 18:55, Luuk wrote:
On 29-12-2014 17:42, Hylton Conacher (ZR1HPC) wrote:
Hi,
I am endeavouring to print a list of my Maildir folders to a file so that I can use that same list when I construct a Procmailrc file.
Initially I ran ~> find $HOME/Maildir -type d -print | sort > /home/hylton/maillistdir
**sample snip*** /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/courierimapkeywords /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/cur /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/new /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/tmp ********
I noticed that there were many sub-folders I did not need. Given this list ended up being 273pg, after a short stint at editing it I decided there had to be a way to exclude certain folders.
What I need is the namesand paths of the folders ie /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari
, not the /cur, /tmp, /new or even the /courierimapkeywords sub-folders.
So far I have:
~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir
The above command returns a 'Command not found' in my destination file of maillistdir.
or try this: find $HOME/Maildir -type d | \ grep -v -e '/new' -e '/tmp' -e '/cur' | \ sort OK BUT FYI,
Your command:
:~> find $HOME/Maildir -type d | \grep -v -e `/new' -e /tmp' -e `/cur' -e `/courierimapkeywords' |\ sort > /home/hylton/maillistdir
Resulted in this error:
:~> bash: /new -e /tmp: No such file or directory
COMPARE the two lines, the one i posted here, and the one you types here. i do not know where the back-quotes(`) come from, i typed normal quotes (') -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 12/30/2014 11:10 AM, Luuk wrote:
i do not know where the back-quotes(`) come from, i typed normal quotes (')
yes, Hylton keeps doing that! HYLTON! RTFM. ' is not the same as ` -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 30/12/14 18:17, Anton Aylward wrote:
On 12/30/2014 11:10 AM, Luuk wrote:
i do not know where the back-quotes(`) come from, i typed normal quotes (')
yes, Hylton keeps doing that!
HYLTON! RTFM.
' is not the same as `
man ` and man ' didn't work so good :) That said I was of the understanding that a command/string was opened with one tick and closed with the other i.e. `/tmp' I guess RTFM on man bash again? sri Hylton -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 01/03/2015 08:41 AM, Hylton Conacher (ZR1HPC) wrote:
On 30/12/14 18:17, Anton Aylward wrote:
On 12/30/2014 11:10 AM, Luuk wrote:
i do not know where the back-quotes(`) come from, i typed normal quotes (')
yes, Hylton keeps doing that!
HYLTON! RTFM.
' is not the same as `
man ` and man ' didn't work so good :)
That said I was of the understanding that a command/string was opened with one tick and closed with the other i.e.
`/tmp'
Why should that be so? In normal usage "quotes match"
I guess RTFM on man bash again?
Yes. There's a lot there but everything that has come up in this thread except specifics of the find command arguments is there. -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Mon, 29 Dec 2014 17:42, Hylton Conacher (ZR1HPC)
Hi,
I am endeavouring to print a list of my Maildir folders to a file so that I can use that same list when I construct a Procmailrc file.
Initially I ran ~> find $HOME/Maildir -type d -print | sort > /home/hylton/maillistdir
**sample snip*** /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/courierimapkeywords /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/cur /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/new /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/tmp ********
I noticed that there were many sub-folders I did not need. Given this list ended up being 273pg, after a short stint at editing it I decided there had to be a way to exclude certain folders.
What I need is the namesand paths of the folders ie /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari
, not the /cur, /tmp, /new or even the /courierimapkeywords sub-folders.
So far I have:
~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir
Please do yourself a favior and use more simple than less and thus more complex tools. Grep is your friend. [code] find $HOME/Maildir -type d -print|\ grep -Ev '/(courierimapkeywords|cur|new|tmp)$' |\ sort > /home/hylton/maillistdir [/code] For find, the name args get the whole dir-name, so the comp would be like ... \( ! -name '*/tmp' \) ... HtH, - Yamaban. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
В Mon, 29 Dec 2014 18:03:22 +0100 (CET)
Yamaban
For find, the name args get the whole dir-name, so the comp would be like ... \( ! -name '*/tmp' \) ...
No, that's wrong. -name matches file name in narrow sense (last component). To match full pathname use -path. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hi, On 29/12/14 19:03, Yamaban wrote:
On Mon, 29 Dec 2014 17:42, Hylton Conacher (ZR1HPC)
wrote: Hi,
I am endeavouring to print a list of my Maildir folders to a file so that I can use that same list when I construct a Procmailrc file.
Initially I ran ~> find $HOME/Maildir -type d -print | sort > /home/hylton/maillistdir
**sample snip*** /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/courierimapkeywords /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/cur /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/new /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/tmp ********
I noticed that there were many sub-folders I did not need. Given this list ended up being 273pg, after a short stint at editing it I decided there had to be a way to exclude certain folders.
What I need is the namesand paths of the folders ie /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari
, not the /cur, /tmp, /new or even the /courierimapkeywords sub-folders.
So far I have:
~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir
Please do yourself a favior and use more simple than less and thus more complex tools. Grep is your friend.
[code] find $HOME/Maildir -type d -print|\ grep -Ev '/(courierimapkeywords|cur|new|tmp)$' |\ sort > /home/hylton/maillistdir [/code]
Thank you. I was thinking of nesting the various folders I want to exclude in a grep query. Unfortunately although I used your code: :~> find $HOME/Maildir -type d -print|\grep -Ev `/{courierimapkaeywords|new|tmp|cur)$' |\sort > /home/hylton/maillistdir it only gave me a > and seemed to be waiting input whereas all te others have just completed and returned me to a $> prompt? What is it waiting for Tnx Hylton -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Tue, 30 Dec 2014 10:10, Hylton Conacher (ZR1HPC)
On 29/12/14 19:03, Yamaban wrote:
On Mon, 29 Dec 2014 17:42, Hylton Conacher (ZR1HPC)
wrote: Hi,
I am endeavouring to print a list of my Maildir folders to a file so that I can use that same list when I construct a Procmailrc file.
Initially I ran ~> find $HOME/Maildir -type d -print | sort > /home/hylton/maillistdir
**sample snip*** /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/courierimapkeywords /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/cur /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/new /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/tmp ********
I noticed that there were many sub-folders I did not need. Given this list ended up being 273pg, after a short stint at editing it I decided there had to be a way to exclude certain folders.
What I need is the namesand paths of the folders ie /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari
, not the /cur, /tmp, /new or even the /courierimapkeywords sub-folders.
So far I have:
~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir
Please do yourself a favior and use more simple than less and thus more complex tools. Grep is your friend.
[code] find $HOME/Maildir -type d -print|\ grep -Ev '/(courierimapkeywords|cur|new|tmp)$' |\ sort > /home/hylton/maillistdir [/code]
Thank you. I was thinking of nesting the various folders I want to exclude in a grep query. Unfortunately although I used your code:
:~> find $HOME/Maildir -type d -print|\grep -Ev `/{courierimapkaeywords|new|tmp|cur)$' |\sort > /home/hylton/maillistdir
it only gave me a > and seemed to be waiting input whereas all te others have just completed and returned me to a $> prompt?
Ok, multiple errors here. 1. mixed quotation marks. You start with a 'backtick' and end with a 'single quote'. 'backticks` are for enclosed commands e.g. [code] echo `date` [/code] showns the output of the date -command. 'single quote' means the enclosed text is given to the command without any interpretation by the shell. Further info: see 'man bash' and search for quoting. 2. mixed brackets. You start with a 'opening curly bracket' and end with a 'closing round bracket'. 'curly brackets' have a complete different meaning (repeat of a search pattern), than 'square brackets', which mean different chars at this possition, or 'round brackets' in combination with 'pipe symbol' / 'vertical slash' which are for mutliple search-pattern in this position. Further info: "man grep" and search for 'Character Classes' and 'Bracket Expressions' correct command in one line: [code] find $HOME/Maildir -type d | grep -Ev '/(courierimapkeywords|cur|new|tmp)$' | sort > /home/hylton/maillistdir [/code] details: 1. for the find command, the 'default last option' is '-print' and can be left off. 2. for the grep command, using only 'single quote' and 'round brackets' is the key to success. 3. the sort command is clear, but be aware that different 'LANG' and 'LC_ALL' settings can influence the sorting order. Cheers, - Yamaban -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 30-12-2014 10:10, Hylton Conacher (ZR1HPC) wrote:
Hi,
On 29/12/14 19:03, Yamaban wrote:
On Mon, 29 Dec 2014 17:42, Hylton Conacher (ZR1HPC)
wrote: Hi,
I am endeavouring to print a list of my Maildir folders to a file so that I can use that same list when I construct a Procmailrc file.
Initially I ran ~> find $HOME/Maildir -type d -print | sort > /home/hylton/maillistdir
**sample snip*** /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/courierimapkeywords /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/cur /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/new /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/tmp ********
I noticed that there were many sub-folders I did not need. Given this list ended up being 273pg, after a short stint at editing it I decided there had to be a way to exclude certain folders.
What I need is the namesand paths of the folders ie /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari
, not the /cur, /tmp, /new or even the /courierimapkeywords sub-folders.
So far I have:
~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir
Please do yourself a favior and use more simple than less and thus more complex tools. Grep is your friend.
[code] find $HOME/Maildir -type d -print|\ grep -Ev '/(courierimapkeywords|cur|new|tmp)$' |\ sort > /home/hylton/maillistdir [/code]
Thank you. I was thinking of nesting the various folders I want to exclude in a grep query. Unfortunately although I used your code:
:~> find $HOME/Maildir -type d -print|\grep -Ev `/{courierimapkaeywords|new|tmp|cur)$' |\sort > /home/hylton/maillistdir
it only gave me a > and seemed to be waiting input whereas all te others have just completed and returned me to a $> prompt?
do i see a back-quote before the /{couriermap.... ?? di i see a '{', and no closing ')' do i see a closing ')' and no opening '{' The purpose of a '\' in a command line is to break it up in more than one line, please the same in your posts here.... ;) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Luuk, On 30/12/14 13:12, Luuk wrote:
On 30-12-2014 10:10, Hylton Conacher (ZR1HPC) wrote:
Hi,
On 29/12/14 19:03, Yamaban wrote:
On Mon, 29 Dec 2014 17:42, Hylton Conacher (ZR1HPC)
wrote: Hi,
I am endeavouring to print a list of my Maildir folders to a file so that I can use that same list when I construct a Procmailrc file.
<snip>
The purpose of a '\' in a command line is to break it up in more than one line, please the same in your posts here.... ;)
Sorry, I do not fully understand the use of \. Quoting from 'man bash': "A non-quoted backslash (\) is the escape character. It preserves the literal value of the next character that follows, with the exception of <newline>. If a \<newline> pair appears, and the backslash is not itself quoted, the \<newline> is treated as a line continuation (that is, it is removed from the input stream and effectively ignored)." Does this mean that each time I get to the end of the line on my cli command, I need to insert \ before the cursor moves to the next line, even if it is in the middle of a command or is it put into a cli command between commands? My command: ~> :~> find $HOME/Maildir -type d | egrep -v "/new"\|"/cur"\|"/tmp"\|"/courie*" |sort > /home/hylton/maillistdir as copied and pasted from my Terminal screen. When this was executed there were no errors yet it did stretch over a single line and had no \'s unless the \ between the double quotes and | count, but unlikely given the definition from man bash. I have looked at the BASH beginners guide that states "The backslash in a terminal view or command synopsis indicates an unfinished line. In other words, if you see a long command that is cut into multiple lines, \ means "Don't press Enter yet!" " So I understand it means the command is not finished yet, but when I executed my command above, without \, it executed without error. Where can I find more info and examples of the usage of \, or is it possibly a configuration setting you have that I don't or vice versa? Interested Hylton -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 3-1-2015 13:47, Hylton Conacher (ZR1HPC) wrote:
Luuk,
Where can I find more info and examples of the usage of \, or is it possibly a configuration setting you have that I don't or vice versa?
Interested
If you type (without the sinfle-quotes) echo "abc" "def" The computer outputs: abc def If you type (and hit the enter-key for every # ): echo "abc" \# "def"# The computer outputs: abc def So, the combination of a '\' followed by an enter is ignored. While this last statement is on two lines of your screen, it is still ONE (command)line to your computer. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 01/03/2015 07:47 AM, Hylton Conacher (ZR1HPC) wrote:
Where can I find more info and examples of the usage of \, or is it possibly a configuration setting you have that I don't or vice versa?
I am at a loss as to why you need more examples when the only cases where it applies are so clearly stated in the man page. -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 01/03/2015 07:47 AM, Hylton Conacher (ZR1HPC) wrote:
I have looked at the BASH beginners guide that states "The backslash in a terminal view or command synopsis indicates an unfinished line. In other words, if you see a long command that is cut into multiple lines, \ means "Don't press Enter yet!" "
So I understand it means the command is not finished yet, but when I executed my command above, without \, it executed without error.
You read, you quote back, but you don't seem to understand. The \<newline> convention is for readability. A single command line expression may run to greater to the width of your display. How to make it clear that is should be one single line, yet still make it readable? Split it up but make use of "continuation character". This is not a new concept, this is not unique to BASH. See, for example http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/chap01/continue.html That's from FORTRAN-77, but dates back even further. I can see it in FORTRAN-66 and think it is in FORTRAN-IV of 1961. The "don't press enter yet" is incorrect, it should be "don't terminate the command line and execute yet". The whole point is that while typing you do type the backslash and then enter, but this is not a "command ended now execute" enter. -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 12/30/2014 04:10 AM, Hylton Conacher (ZR1HPC) wrote:
Thank you. I was thinking of nesting the various folders I want to exclude in a grep query. Unfortunately although I used your code:
:~> find $HOME/Maildir -type d -print|\grep -Ev 1
`/{courierimapkaeywords|new|tmp|cur)$' |\sort > /home/hylton/maillistdir 234 567 8
The numbers are under characters in the CLI that I have contention with 1. No need for this "\". 8. Again. The backslash escape is not needed. RTFM MAN(bash) on "QUOTING" What happened here? As earlier posing wrote find $HOME/Maildir -type d -print|\ grep -Ev If you read the man page section I referred to it says <quote> A non-quoted backslash (\) is the escape character. It preserves the literal value of the next character that follows, with the exception of <newline>. If a \<new-line> pair appears, and the backslash is not itself quoted, the \<newline> is treated as a line continuation (that is, it is removed from the input stream and effectively ignored). </quote> That is the backslash is a line continuation character. It means, in the above example, that all the stuff is on one line. Those backquotes should not appear when you do make it into one line. Just as a side issue, in situation like this I use 'egrep' but then I'm one of the Greybeard Brigade. 2. The backtick is a command pipe. See the BASH man page on COMMAND SUBSTITUTION <quote> Command Substitution Command substitution allows the output of a command to replace the command name. There are two forms: $(command) or `command` </quote> As it happens, the backtick is unclosed. The character at "7" does not close it. 3,4,5,6,7 I can't see the reason for this Yes the parameter to grep should be quoted, but that's all. I would have used egrep -v "courierimapkaeywords|new|tmp|cur" A bit of RTFM and a bit of experimentation with each command separately would have uncovered a lot. KISS. There is no need for the braces. What? Oh, I see, there's the "$" meaning that the set has to be at the end of line. The pattern needs to be "(courierimapkaeywords|new|tmp|cur)$" We can now get into an argument about whether on not to use single quotes or double quotes. That matter has used much e-ink on the 'Net and on USENET before it. Read the man page and make up your own mind, but have a reason for it. We can now have an argument over whether the "-E". "-G" or "-e" is needed for that pattern or whether using egrep rather than grep makes that moot. The takeaway from all this is RTFM and KISS Going back over this thread I see that there are some very complicated "find" expressions and the use of a pipe and grep was, true enough, an effort to simplify. But somewhere along the line it got derailed. As far as I'm concerned the wonderful thing about the CLI is that I can build and test commands incrementally, experiment with variations and see what's going on. I'd probably fail an exam since I keep referring back to the man an info pages to make sure. Shell is my favourite language because of this interaction and easy incrementalism. -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Aaron, Thank you for the time and comments posted. All valid and I have replied in-line. On 30/12/14 15:19, Anton Aylward wrote:
On 12/30/2014 04:10 AM, Hylton Conacher (ZR1HPC) wrote:
Thank you. I was thinking of nesting the various folders I want to exclude in a grep query. Unfortunately although I used your code:
:~> find $HOME/Maildir -type d -print|\grep -Ev 1
`/{courierimapkaeywords|new|tmp|cur)$' |\sort > /home/hylton/maillistdir 234 567 8
The numbers are under characters in the CLI that I have contention with
1. No need for this "\". 8. Again. The backslash escape is not needed.
RTFM MAN(bash) on "QUOTING"
Thanks, man page read and understood to some extent. As I mentioned to Luuk, whilst \ indicates that the command is not finished and continues on the next line, my command of :~> find $HOME/Maildir -type d | egrep -v "/new"\|"/cur"\|"/tmp"\|"/courie*" |sort > /home/hylton/maillistdir was entered on one line in Terminal despite spilling over to two lines, had no backslashes, why? The above command executed without error. My Terminal is 72 x 21 and I do not understand where to place the backslash i.e. before/after pipes redirection etc. OR did I use them i.e. after "/new", "/cur" and "/tmp" but not after "/courie*"?
As earlier posing wrote
find $HOME/Maildir -type d -print|\ grep -Ev
If you read the man page section I referred to it says
man page read, re-read and noted as a starting point before scripting again. :)
That is the backslash is a line continuation character. It means, in the above example, that all the stuff is on one line. Those backquotes should not appear when you do make it into one line.
But are they needed given the above command executed fine despite being more then one line long?
Just as a side issue, in situation like this I use 'egrep' but then I'm one of the Greybeard Brigade.
NP, as from the man page <quote> egrep is the same as grep -E. </quote>
2. The backtick is a command pipe. See the BASH man page on COMMAND SUBSTITUTION
Seems <quote> $>man bash </quote> is going to be VERY WELL read :) <snip>
A bit of RTFM and a bit of experimentation with each command separately would have uncovered a lot.
I would agree, however in my own defence knowing what to look up in the man pages is always a good starting point :)
KISS.
There is no need for the braces.
and my learning continues :) <snip>
We can now get into an argument about whether on not to use single quotes or double quotes. That matter has used much e-ink on the 'Net and on USENET before it. Read the man page and make up your own mind, but have a reason for it.
My 2c: Double quotes are better because it seems single quotes can be acted upon inside them whereas they cannot if enclosed in single quotes.
We can now have an argument over whether the "-E". "-G" or "-e" is needed for that pattern or whether using egrep rather than grep makes that moot.
Lets not but rather concentrate on learning to code cli commands so that they give us the correct answers we seek.
The takeaway from all this is
RTFM and KISS
Going back over this thread I see that there are some very complicated "find" expressions and the use of a pipe and grep was, true enough, an effort to simplify. But somewhere along the line it got derailed.
As far as I'm concerned the wonderful thing about the CLI is that I can build and test commands incrementally, experiment with variations and see what's going on. I'd probably fail an exam since I keep referring back to the man an info pages to make sure. Shell is my favourite language because of this interaction and easy incrementalism.
Guess the only one to not play with is # rm / :) Thanks for info and time and knowledge gained. I cannot promise to remember it all but hopefully the links will remain as to where to find the necessary information. Regards Hylton -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 01/03/2015 08:35 AM, Hylton Conacher (ZR1HPC) wrote:
Aaron,
That aNTon not aARon. You don't want to deal with aaron, trust me!
Thank you for the time and comments posted. All valid and I have replied in-line.
On 30/12/14 15:19, Anton Aylward wrote:
On 12/30/2014 04:10 AM, Hylton Conacher (ZR1HPC) wrote:
.... [snip] ..
RTFM MAN(bash) on "QUOTING"
Thanks, man page read and understood to some extent. As I mentioned to Luuk, whilst \ indicates that the command is not finished and continues on the next line,
NO! A \ at the end of the line indicates the command is not finished, as in find $HOME/Maildir -type d | egrep -v \ ..... A \ inline means "take the next character literally" So when you pasted the multiline command as a single line the ..... \ | .. got converted to ...... \| ...... Stop and think. Interpret that in terms of what i just said above. The backslashes are redundant but do not actually affect operation. What's going on here is that you made a mistake that cancelled itself out, but was a mistake none the less and simply added to the confusion.
That is the backslash is a line continuation character. It means, in the above example, that all the stuff is on one line. Those backquotes should not appear when you do make it into one line.
But are they needed given the above command executed fine despite being more then one line long?
Seems <quote> $>man bash </quote> is going to be VERY WELL read :)
${EXPLETIVE} ${OBSCENITY} RIGHT! Almost all your problems arise from a lack of understand of shell basics.
<snip>
A bit of RTFM and a bit of experimentation with each command separately would have uncovered a lot.
I would agree, however in my own defence knowing what to look up in the man pages is always a good starting point :)
$ man bash $ man bashbuiltins http://shop.oreilly.com/product/9780596009656.do or if you don't like dead trees http://ibi.cqupt.edu.cn/download/computer/linux/Learning.the.Bash.Shell.3rd.... even googling for "learning bash shell" will help you. GO GOOGLE! But the real issue is diligent study not just a superficial scan and asking for hand-holding over every detail.
My 2c: Double quotes are better because it seems single quotes can be acted upon inside them whereas they cannot if enclosed in single quotes.
NOT! Context is Everything. First, don't confuse single quotes with backtiks. If you had RTFM you'd see that 'string' is not the same as `string` You should also look to see what $(string) is You should also look to see the differnce between '$PATH' and "$PATH" Oh, and '\$PATH' and "\$PATH" and while about it '\\$PATH' and "\\$PATH" The issue isn't that one is right or one is better, it is a matter of what is appropriate in the particular context. You should also understand how quotes of various kinds are "stripped off" as arguments are passed. And yes it is all in the shell man page.
Lets not but rather concentrate on learning to code cli commands so that they give us the correct answers we seek.
As Larry said about Perl, but its equally applicable to shell, (or Ruby, or C or just about any language) There's more than one one way to do things. There are not 'correct answers', only answers that give us the results we want. -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2015-01-03 15:40, Anton Aylward wrote:
On 01/03/2015 08:35 AM, Hylton Conacher (ZR1HPC) wrote:
Aaron,
That aNTon not aARon. You don't want to deal with aaron, trust me!
There is somebody else with that name here which I think is not the same one. -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar)
* Hylton Conacher (ZR1HPC)
So far I have:
~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir
The above command returns a 'Command not found' in my destination file of maillistdir.
I have RTFM'd, Googled and still cannot find an example of what I want to do. I even visited the sites Aaron Digulla gave me on an earlier pointing to the complexities of find.
Any more help appreciated
As you are not familiar with "find", go with what you have and use "grep -v" Grep works by line and "-v" reverses search to lines not containing and you could tack onto the end of your present "find", | egrep -v "/new"\|"/cur"\|"/tmp" > /home/hylton/maillistdir negative targets include forward slashes and are quoted to hopefully not find matching directories you desire. -- (paka)Patrick Shanahan Plainfield, Indiana, USA @ptilopteri http://en.opensuse.org openSUSE Community Member facebook/ptilopteri http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 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
Hi Patrick, On 29/12/14 20:10, Patrick Shanahan wrote:
* Hylton Conacher (ZR1HPC)
[12-29-14 11:45]: [...] So far I have:
~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir
The above command returns a 'Command not found' in my destination file of maillistdir.
I have RTFM'd, Googled and still cannot find an example of what I want to do. I even visited the sites Aaron Digulla gave me on an earlier pointing to the complexities of find.
Any more help appreciated
As you are not familiar with "find", go with what you have and use "grep -v" Grep works by line and "-v" reverses search to lines not containing and you could tack onto the end of your present "find", | egrep -v "/new"\|"/cur"\|"/tmp" > /home/hylton/maillistdir
negative targets include forward slashes and are quoted to hopefully not find matching directories you desire.
Tnx Following your lead I extended the cmd to be :~> find $HOME/Maildir -type d | egrep -v "/new"\|"/cur"\|"/tmp"\|"/courie*"\ -print |sort > /home/hylton/maillistdir however on viewing the maillistdir file, the /courierimapkeywords folder is still listed? What am I missing? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Tue, Dec 30, 2014 at 9:41 AM, Hylton Conacher (ZR1HPC)
Hi Patrick,
On 29/12/14 20:10, Patrick Shanahan wrote:
* Hylton Conacher (ZR1HPC)
[12-29-14 11:45]: [...] So far I have:
~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir
The above command returns a 'Command not found' in my destination file of maillistdir.
I have RTFM'd, Googled and still cannot find an example of what I want to do. I even visited the sites Aaron Digulla gave me on an earlier pointing to the complexities of find.
Any more help appreciated
As you are not familiar with "find", go with what you have and use "grep -v" Grep works by line and "-v" reverses search to lines not containing and you could tack onto the end of your present "find", | egrep -v "/new"\|"/cur"\|"/tmp" > /home/hylton/maillistdir
negative targets include forward slashes and are quoted to hopefully not find matching directories you desire.
Tnx
Following your lead I extended the cmd to be :~> find $HOME/Maildir -type d | egrep -v "/new"\|"/cur"\|"/tmp"\|"/courie*"\ -print |sort > /home/hylton/maillistdir
however on viewing the maillistdir file, the /courierimapkeywords folder is still listed?
Because you try to match pattern "/courie* -print". Remove "\ -print", it is in the wrong place and is not needed. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 30/12/14 10:33, Andrei Borzenkov wrote:
On Tue, Dec 30, 2014 at 9:41 AM, Hylton Conacher (ZR1HPC)
wrote: Hi Patrick,
On 29/12/14 20:10, Patrick Shanahan wrote:
* Hylton Conacher (ZR1HPC)
[12-29-14 11:45]: [...] So far I have:
~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir
The above command returns a 'Command not found' in my destination file of maillistdir.
I have RTFM'd, Googled and still cannot find an example of what I want to do. I even visited the sites Aaron Digulla gave me on an earlier pointing to the complexities of find.
Any more help appreciated
As you are not familiar with "find", go with what you have and use "grep -v" Grep works by line and "-v" reverses search to lines not containing and you could tack onto the end of your present "find", | egrep -v "/new"\|"/cur"\|"/tmp" > /home/hylton/maillistdir
negative targets include forward slashes and are quoted to hopefully not find matching directories you desire.
Tnx
Following your lead I extended the cmd to be :~> find $HOME/Maildir -type d | egrep -v "/new"\|"/cur"\|"/tmp"\|"/courie*"\ -print |sort > /home/hylton/maillistdir
however on viewing the maillistdir file, the /courierimapkeywords folder is still listed?
Because you try to match pattern "/courie* -print". Remove "\ -print", it is in the wrong place and is not needed.
OK so the command is: :~> find $HOME/Maildir -type d | egrep -v "/new"\|"/cur"\|"/tmp"\|"/courie* |sort > /home/hylton/maillistdir All this gives me is a > prompt not my usual :~> and and no file to view. Inly Ctrl-C reverts to te standard prompt. All this is SO close yet we are all missing something!! HTH Hylton -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2014-12-30 17:24, Hylton Conacher (ZR1HPC) wrote:
On 30/12/14 10:33, Andrei Borzenkov wrote:
OK so the command is:
:~> find $HOME/Maildir -type d | egrep -v "/new"\|"/cur"\|"/tmp"\|"/courie* |sort > /home/hylton/maillistdir
All this gives me is a > prompt not my usual :~> and and no file to view. Inly Ctrl-C reverts to te standard prompt.
Count the quotes. There is one missing. -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar)
Carlos, sri for coming back a few days later but Happy New Year to ALL. On 30/12/14 18:33, Carlos E. R. wrote:
On 2014-12-30 17:24, Hylton Conacher (ZR1HPC) wrote:
On 30/12/14 10:33, Andrei Borzenkov wrote:
OK so the command is:
:~> find $HOME/Maildir -type d | egrep -v "/new"\|"/cur"\|"/tmp"\|"/courie* |sort > /home/hylton/maillistdir
All this gives me is a > prompt not my usual :~> and and no file to view. Inly Ctrl-C reverts to te standard prompt.
Count the quotes. There is one missing.
THANKYOU. A * is certainly not a " I have most definitely learnt something constructing this cli cmd, and to top it all it was rather fun :) Thanks again to ALL Regards Hylton -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 12/30/2014 11:24 AM, Hylton Conacher (ZR1HPC) wrote:
:~> find $HOME/Maildir -type d | egrep -v "/new"\|"/cur"\|"/tmp"\|"/courie* |sort > /home/hylton/maillistdir
All this gives me is a > prompt not my usual :~> and and no file to view. Inly Ctrl-C reverts to te standard prompt.
All this is SO close yet we are all missing something!!
Aw Gee, why don't you RTFM What you've gor there are a series of piped commands: 1. Find $HOME/Maildir -type d 2. Egrep -v "/new" 3. "/cur" 4. "/tmp" 5. "/courie* |sort > /home/hylton/maillistdir What the line should read is to omit the internal closing quotes and backslashes and have a proper closing quote: find $HOME/Maildir -type d | egrep -v "/new|/cur|/tmp|/courie*" |sort > /home/hylton/maillistdir If you're going to use backslashes to escape anything, the it should be the forward slashes in a regular expression egrep -v -E "\/new|\/cur|\/tmp|\/courie*" If you'd read the man page on shell, the sections I'd referred to, you'd see what I'm getting at here. Hylton, you real problem here is that you are doing cut and paste from a number of people who are using the shell in slightly different ways without any learning on your part going on. If you stepped back and tried learning, tried experimenting with parts rather than focusing on just this one command sequence then (a) you'd be able to generate the correct command sequence on your own and (b) you'd understand how to write shell command sequences, pipes and filters in the future and save all this hassle. i'm known for the line Context is Everything and its pretty much a maxim here because everyone has their system configured in their own way. Linux is not as restrictive as Windows. We can't solve your problems in detail, we can advise but you have to experiment and learn and interpret in your own context. There has to be effort on your part and just doing this cut-and-paste is not helping you learn. All the problems you are encountering could have been avoided of you read the manuals and examples on the web and experimented with parts. Linux, Unix, is not Windows, it is not about dumb pressing buttons and checking boxes on a GUI, it takes initiative and paying attention to what's in the manuals. -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 30/12/14 18:54, Anton Aylward wrote:
On 12/30/2014 11:24 AM, Hylton Conacher (ZR1HPC) wrote:
:~> find $HOME/Maildir -type d | egrep -v "/new"\|"/cur"\|"/tmp"\|"/courie* |sort > /home/hylton/maillistdir
All this gives me is a > prompt not my usual :~> and and no file to view. Inly Ctrl-C reverts to te standard prompt.
All this is SO close yet we are all missing something!!
Aw Gee, why don't you RTFM
The Fine Manual needs to know what to show me. Thankfully man bash will now become a starting point.
What you've gor there are a series of piped commands:
1. Find $HOME/Maildir -type d
2. Egrep -v "/new"
3. "/cur"
4. "/tmp"
5. "/courie* |sort > /home/hylton/maillistdir
What the line should read is to omit the internal closing quotes and backslashes and have a proper closing quote:
find $HOME/Maildir -type d | egrep -v "/new|/cur|/tmp|/courie*" |sort > /home/hylton/maillistdir
If you're going to use backslashes to escape anything, the it should be the forward slashes in a regular expression
egrep -v -E "\/new|\/cur|\/tmp|\/courie*"
If you'd read the man page on shell, the sections I'd referred to, you'd see what I'm getting at here.
Hylton, you real problem here is that you are doing cut and paste from a number of people who are using the shell in slightly different ways without any learning on your part going on. If you stepped back and tried learning, tried experimenting with parts rather than focusing on just this one command sequence then (a) you'd be able to generate the correct command sequence on your own and (b) you'd understand how to write shell command sequences, pipes and filters in the future and save all this hassle.
I fully respect that you believe I am not learning, but the contrary is true. Saying RTFM is easy but knowing what to RTFM is way more important.
i'm known for the line
Context is Everything
No offence but I believe Syntax is everything :)
and its pretty much a maxim here because everyone has their system configured in their own way. Linux is not as restrictive as Windows. We can't solve your problems in detail, we can advise but you have to experiment and learn and interpret in your own context. There has to be effort on your part and just doing this cut-and-paste is not helping you learn.
All the problems you are encountering could have been avoided of you read the manuals and examples on the web and experimented with parts. Linux, Unix, is not Windows, it is not about dumb pressing buttons and checking boxes on a GUI, it takes initiative and paying attention to what's in the manuals.
Your last two paragraphs are a little harsh but I understand that Linux is not Windows since I have been using KDE for close on 4 years. The cli is new territory to me so just like KDE was a new GUI 4 years ago my learning curve just restarted in the vertical plane. I appreciate all the help and pointers but not understanding the internal workings like I wish to, it is a little difficult to make headway without pleading totally stupidity. Regards Hylton -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 01/03/2015 09:11 AM, Hylton Conacher (ZR1HPC) wrote:
I fully respect that you believe I am not learning, but the contrary is true. Saying RTFM is easy but knowing what to RTFM is way more important.
You are missing the point. Any culture has its own way of documentation and expression. Linux manuals are actually more complete than UNIX ones ever were! Just as people who have been reading the Bible or the Torah for years can still re-read and learn more, so too with us. You are asking us to not only point out every detail for you but to do all the interpretation for you. We can't act as a crutch for you in every context. What we've been discussing in this thread are really not so much BASH issues as computer science fundamentals, the difference between a string, a variable and a command; how to pass parameters, how variables are evaluated, have arguments passed (by reference or by value). Without that understanding and being able to differentiate, as seems your case, we are all going to get frustrated. -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 01/03/2015 09:11 AM, Hylton Conacher (ZR1HPC) wrote:
Your last two paragraphs are a little harsh but I understand that Linux is not Windows since I have been using KDE for close on 4 years. The cli is new territory to me so just like KDE was a new GUI 4 years ago my learning curve just restarted in the vertical plane.
I appreciate all the help and pointers but not understanding the internal workings like I wish to, it is a little difficult to make headway without pleading totally stupidity.
If all you see is a GUI, if you don't understand how the GUI is an overlay for the underlying commands, then there isn't really a lot of difference between KDE and Windows. http://faculty.georgetown.edu/irvinem/theory/Stephenson-CommandLine-1999.pdf The "internal workings" are the basics of any computer language, strings, variables, commands, evaluation of variables, passing parameters -- by address or by value, indirections, and such like. They are not unique to the shell. -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Am 30.12.2014 um 07:41 schrieb Hylton Conacher (ZR1HPC):
Following your lead I extended the cmd to be :~> find $HOME/Maildir -type d | egrep -v "/new"\|"/cur"\|"/tmp"\|"/courie*"\ -print |sort > /home/hylton/maillistdir
"/courie*"\ -print is the same as "/courie* -print" i.e. you look a folder name which starts with "courie" and ends with " -print". Use ... | egrep -v "/(new|cur|tmp)" | ... ("cur" will also match "courie") Also "*" doesn't work with egrep, it must be ".*" When using regexp, "e*" means "zero or more 'e'" This looks like a decent introduction to regexp: http://regexone.com/ Regards, -- Aaron "Optimizer" Digulla a.k.a. Philmann Dark "It's not the universe that's limited, it's our imagination. Follow me and I'll show you something beyond the limits." http://blog.pdark.de/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hi Aaron, Tnx for some tutoring, it will help. On 31/12/14 13:40, Aaron Digulla wrote:
Am 30.12.2014 um 07:41 schrieb Hylton Conacher (ZR1HPC):
Following your lead I extended the cmd to be :~> find $HOME/Maildir -type d | egrep -v "/new"\|"/cur"\|"/tmp"\|"/courie*"\ -print |sort > /home/hylton/maillistdir
"/courie*"\ -print
is the same as
"/courie* -print"
understood the \ needn't have been there, why I do not know as my command ended up being over a line long without any \, and executed perfectly.
i.e. you look a folder name which starts with "courie" and ends with " -print".
understand
Use
... | egrep -v "/(new|cur|tmp)" | ...
as the double quotes encase what egrep must not display i.e. the folders /new, /cur, /tmp
("cur" will also match "courie")
Umm, why and I disagree as there is an o in the courie string being searched for?
Also "*" doesn't work with egrep, it must be ".*" When using regexp, "e*" means "zero or more 'e'"
Thank-you. I was hoping it would be a wildcard for any characters thereafter.
This looks like a decent introduction to regexp: http://regexone.com/
Bookmarked and will read. Regards Hylton -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 01/03/2015 09:30 AM, Hylton Conacher (ZR1HPC) wrote:
("cur" will also match "courie")
Umm, why and I disagree as there is an o in the courie string being searched for?
Why didn’t you experiment with grep to determine what patterns can and cannot match. The best way to learn the CLI is to experiment, try out the commands and see how the various arguments and parameters work out. You may find it unpleasant to be told so, but an understanding of regular expressions is essential to using Linux, be it at the CLI level or even with GUI. -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2015-01-03 15:30, Hylton Conacher (ZR1HPC) wrote:
Also "*" doesn't work with egrep, it must be ".*" When using regexp, "e*" means "zero or more 'e'"
Thank-you. I was hoping it would be a wildcard for any characters thereafter.
Not if the command uses the "regexp" syntax (or regular expresions). It can be confusing. "egrep" uses it, "grep" does not. Notice in the "grep" manual the entries for "-e" and "-E". -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar)
В Sat, 03 Jan 2015 23:06:44 +0100
"Carlos E. R."
On 2015-01-03 15:30, Hylton Conacher (ZR1HPC) wrote:
Also "*" doesn't work with egrep, it must be ".*" When using regexp, "e*" means "zero or more 'e'"
Thank-you. I was hoping it would be a wildcard for any characters thereafter.
Not if the command uses the "regexp" syntax (or regular expresions).
In Linux they are documented under regex(7) manual page.
It can be confusing. "egrep" uses it, "grep" does not.
Both grep and egrep are using regular expressions; difference is between basic and extended. But meaning of '.' and '*' remains the same in both cases.
Am 03.01.2015 um 15:30 schrieb Hylton Conacher (ZR1HPC):
Hi Aaron,
("cur" will also match "courie")
Umm, why and I disagree as there is an o in the courie string being searched for?
Ooops. You're right, of course :-) Regards, -- Aaron "Optimizer" Digulla a.k.a. Philmann Dark "It's not the universe that's limited, it's our imagination. Follow me and I'll show you something beyond the limits." http://blog.pdark.de/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 29-12-2014 17:42, Hylton Conacher (ZR1HPC) wrote:
Tnx Hylton
you should study the output of this:
a=abcdef echo $a abcdef echo '$a' $a echo "$a" abcdef echo `$a` abcdef: command not found
and try to understand the differences......... i (intentionally ) left out:
echo "$a' " abcdef'
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Tnx Luuk, On 30/12/14 18:50, Luuk wrote:
On 29-12-2014 17:42, Hylton Conacher (ZR1HPC) wrote:
Tnx Hylton
you should study the output of this:
a=abcdef a= the all characters abcdef as more than one is specified.
echo $a abcdef Displays the string of a
echo '$a' $a Displays what's between back quotes echo "$a" abcdef As per previous example echo `$a` abcdef: command not found Would display the command between the forward quotes although I would think the command would be in-between a forward and back quote.
No idea
and try to understand the differences.........
i (intentionally ) left out:
echo "$a' " abcdef'
I do not understand the syntax of the ones you intentionally left out, if they are indeed valid. Regards Hylton -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
* Hylton Conacher (ZR1HPC)
On 30/12/14 18:50, Luuk wrote:
you should study the output of this:
a=abcdef
a= the all characters abcdef as more than one is specified.
echo $a abcdef Displays the string of a
echo '$a' $a Displays what's between back quotes
You are confused or leading yourself into more confusion. They are not "back quotes" but "single quotes". As Anton would muse, "Context *is* everything".
echo "$a" abcdef As per previous example
enclosed in "double quotes" or "quotes" as the weighted *guess* would be double, more used.
echo `$a` abcdef: command not found Would display the command between the forward quotes although I would think the command would be in-between a forward and back quote.
again, not "forward quotes" but "tics" or "back quotes" And they all act different "according to context", double quotes (re: quotes) single quotes tics (or back quotes) And, "\" is a "line continuation character" but only at the end of a line and not necessary to use one the command line unless you use the enter key to move to the next line and intend to use the line(s) typed as a single command, again "context". Elsewhere it acts as an "excape" character to enable one to use the following character literally rather than as a command character such as # or $ or \ so using \\ would make the second \ a backslash rather than an escape character. and I hope I haven't confused myself, as I do. -- (paka)Patrick Shanahan Plainfield, Indiana, USA @ptilopteri http://en.opensuse.org openSUSE Community Member facebook/ptilopteri http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 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
On 01/03/2015 09:19 AM, Patrick Shanahan wrote:
You are confused or leading yourself into more confusion. They are not "back quotes" but "single quotes". As Anton would muse, "Context *is* everything".
As my eyes deteriorate with age and enlarging fonts so there is only one character on the screen at a time does not help (much), I've take to not using "backticks" for embedding commands but rather the $(command) syntax so as to be visibly explicit. YMMV. -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 01/03/2015 08:54 AM, Hylton Conacher (ZR1HPC) wrote:
echo $a abcdef Displays the string of a
NOT! Evaluates the variable "a" See man page on "expansion"
echo '$a' $a Displays what's between back quotes
For a start those are single quotes not back-quotes or back-ticks. Second, see the man page on the difference in how shell variables are evaluated when quoted differently. " is not the same as '. See, once again, under QUOTING ... There are three quoting mechanisms: the escape character, single quotes, and double quotes.
echo "$a" abcdef As per previous example echo `$a` abcdef: command not found Would display the command between the forward quotes although I would think the command would be in-between a forward and back quote.
NO! If you want to use that pernicious type of wording rather than that of the man page, it would read would display THE RESULT OF EVALUATING THE COMMAND between the BACK quotes The rest of what you say leads mot think you are still confused, not least of all over such matters as evaluation of variables and 'indirection'. So much of the distinction we are trying to point out here is computing 101. Please step back and think what is the difference between a string, a variable, and argument to a command. -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hello, The command in your case should be: find $HOME/Maildir -type d -path *cur* -prune -o -path *new* -prune -o -path *tmp* -prune -o -path *courierimapkeywords* -prune -o -print I hope this will help you. Best Regards, I.Petrov On 12/29/2014 06:42 PM, Hylton Conacher (ZR1HPC) wrote:
Hi,
I am endeavouring to print a list of my Maildir folders to a file so that I can use that same list when I construct a Procmailrc file.
Initially I ran ~> find $HOME/Maildir -type d -print | sort > /home/hylton/maillistdir
**sample snip*** /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/courierimapkeywords /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/cur /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/new /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari/tmp ********
I noticed that there were many sub-folders I did not need. Given this list ended up being 273pg, after a short stint at editing it I decided there had to be a way to exclude certain folders.
What I need is the namesand paths of the folders ie /home/hylton/Maildir/.INBOX.A-F.Bookstores.Kalahari
, not the /cur, /tmp, /new or even the /courierimapkeywords sub-folders.
So far I have:
~> find $HOME/Maildir -type d \( ! -name tmp \) -o \( ! -name cur \) -o \( ! -name new \) -o \( ! -name courierimapkeywords \) | -print | sort > /home/hylton/maillistdir
The above command returns a 'Command not found' in my destination file of maillistdir.
I have RTFM'd, Googled and still cannot find an example of what I want to do. I even visited the sites Aaron Digulla gave me on an earlier pointing to the complexities of find.
Any more help appreciated
Tnx Hylton -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hi, On 03/01/15 02:19, I.Petrov wrote:
Hello,
The command in your case should be:
find $HOME/Maildir -type d -path *cur* -prune -o -path *new* -prune -o -path *tmp* -prune -o -path *courierimapkeywords* -prune -o -print
This command is another way to do it but I am unsure of the wildcard characters(*) you have used and will require lots more reading of the prune man page. The following command entered on a single line worked and provided what I required: <quote> find $HOME/Maildir -type d | egrep -v "/new"\|"/cur"\|"/tmp"\|"/courie*" |sort > /home/hylton/maillistdir </quote> Tnx for the assistance Hylton -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hylton Conacher (ZR1HPC) wrote:
Hi,
On 03/01/15 02:19, I.Petrov wrote:
Hello,
The command in your case should be:
find $HOME/Maildir -type d -path *cur* -prune -o -path *new* -prune -o -path *tmp* -prune -o -path *courierimapkeywords* -prune -o -print
This command is another way to do it but I am unsure of the wildcard characters(*) you have used
Those aren't wildcards, they're for highlighting. -- Per Jessen, Zürich (8.3°C) http://www.hostsuisse.com/ - dedicated server rental in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2015-01-03 18:26, Per Jessen wrote:
Hylton Conacher (ZR1HPC) wrote:
Hi,
On 03/01/15 02:19, I.Petrov wrote:
Hello,
The command in your case should be:
find $HOME/Maildir -type d -path *cur* -prune -o -path *new* -prune -o -path *tmp* -prune -o -path *courierimapkeywords* -prune -o -print
This command is another way to do it but I am unsure of the wildcard characters(*) you have used
Those aren't wildcards, they're for highlighting.
Oh my. One should never do that on text that is not text, but a command line example. It confuses things. Anyway, the command does not work, it finds files inside those paths. Not only the master folders. cer@Telcontar:~> find $HOME/Mail/maildir/ -type d -path cur -prune -o -path new -prune -o -path tmp -prune -o -path courierimapkeywords -prune -o -print /home/cer/Mail/maildir/ /home/cer/Mail/maildir/new /home/cer/Mail/maildir/new/1415018721.19713_2.Telcontar /home/cer/Mail/maildir/new/1415176204.20175_2.Telcontar The mails of the "new" directory should not be displayed. -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, Actually I didn't know that the asterisks can be used for highlighting in the mailing list. Anyway, the asterisks (at least this in front of the directory name e.g. *cur) are *required* in the command line in order the directories to be omitted. Sorry for the confusion. Best Regards, I.Petrov On 01/04/2015 04:55 AM, Carlos E. R. wrote:
On 2015-01-03 18:26, Per Jessen wrote:
Hylton Conacher (ZR1HPC) wrote:
Hi,
On 03/01/15 02:19, I.Petrov wrote:
Hello,
The command in your case should be:
find $HOME/Maildir -type d -path *cur* -prune -o -path *new* -prune -o -path *tmp* -prune -o -path *courierimapkeywords* -prune -o -print
This command is another way to do it but I am unsure of the wildcard characters(*) you have used
Those aren't wildcards, they're for highlighting.
Oh my.
One should never do that on text that is not text, but a command line example. It confuses things.
Anyway, the command does not work, it finds files inside those paths. Not only the master folders.
cer@Telcontar:~> find $HOME/Mail/maildir/ -type d -path cur -prune -o -path new -prune -o -path tmp -prune -o -path courierimapkeywords -prune -o -print /home/cer/Mail/maildir/ /home/cer/Mail/maildir/new /home/cer/Mail/maildir/new/1415018721.19713_2.Telcontar /home/cer/Mail/maildir/new/1415176204.20175_2.Telcontar
The mails of the "new" directory should not be displayed.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBAgAGBQJUqRdNAAoJEH8sJoKRFRU5760P/2yx0cTrhgj/tbizU0+xHE62 P3+XzKm2Y38I7b4uIwGFUInZ/dYcId4HNh+VBlhyJIXCrAmJS5prN5mu/ToECuIl w6q4qhSuspkdVGK3H/6VIktZal5K1KfAMq4wws2ZM5ody69ICtROUeimntYdqfdi 8rxok1eBnBQO1pTwkNu4i+UIr4VKFcPebjHQsXz83MSwKViFMX8FMsXOfuBGE1rP L660zIhWs3QxeUmwnnKZItOmDvLVVKuHBvH0T3TAwFy8c2ju1Bzf+lDSpNize2Oy sH3elVO1L2J6ZLOM4SQ6RsjIXCM43Tiv9Zcbtwi2Bh1e9WgP8gUOu5g4x7Sucm2J cLUxF7GGxF1lF65oEhVp+In1jv6Z5ixg8yp4HewdFT7c9mGpqD8bXr77yPwBqn8B 7xUOmGJNo+PcWTxK1b1A01nQiQQ0qj+cD8nlhLT+jYORFhP4lHPLm7WeRjc6YWvA wtzrCDBdLwJLVI7JaCP6idCxBC21gJZrsiP9FzDfppJUA7hE+8QROTPFsoU0EFrt UmFD8p7HKvxRPNKOEJYQCpCro9YXZP0TVV7GoqNHMIslgDpqIc8OtBCcfRpwbmln PLgnHHzsppZQruavzlNhUkx09gwHPaHnPJKw8ZdAyfMnia4D6aFMoR27l14huk6m DOP8T0CBSDXNxxiRwqYa =SGXF -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
В Sun, 04 Jan 2015 12:34:53 +0200
"I.Petrov"
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hello,
Actually I didn't know that the asterisks can be used for highlighting in the mailing list. Anyway, the asterisks (at least this in front of the directory name e.g. *cur) are *required* in the command line in order the directories to be omitted.
That's true, because you used -path. But if you want to match every directory nameed "cur" using -name is more simple (and probably slightly more efficient). -path is usually useful when you want to match one specific instance of given name only. Sorry for the confusion.
Best Regards, I.Petrov
On 01/04/2015 04:55 AM, Carlos E. R. wrote:
On 2015-01-03 18:26, Per Jessen wrote:
Hylton Conacher (ZR1HPC) wrote:
Hi,
On 03/01/15 02:19, I.Petrov wrote:
Hello,
The command in your case should be:
find $HOME/Maildir -type d -path *cur* -prune -o -path *new* -prune -o -path *tmp* -prune -o -path *courierimapkeywords* -prune -o -print
This command is another way to do it but I am unsure of the wildcard characters(*) you have used
Those aren't wildcards, they're for highlighting.
Oh my.
One should never do that on text that is not text, but a command line example. It confuses things.
Anyway, the command does not work, it finds files inside those paths. Not only the master folders.
cer@Telcontar:~> find $HOME/Mail/maildir/ -type d -path cur -prune -o -path new -prune -o -path tmp -prune -o -path courierimapkeywords -prune -o -print /home/cer/Mail/maildir/ /home/cer/Mail/maildir/new /home/cer/Mail/maildir/new/1415018721.19713_2.Telcontar /home/cer/Mail/maildir/new/1415176204.20175_2.Telcontar
The mails of the "new" directory should not be displayed.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAEBAgAGBQJUqRdNAAoJEH8sJoKRFRU5760P/2yx0cTrhgj/tbizU0+xHE62 P3+XzKm2Y38I7b4uIwGFUInZ/dYcId4HNh+VBlhyJIXCrAmJS5prN5mu/ToECuIl w6q4qhSuspkdVGK3H/6VIktZal5K1KfAMq4wws2ZM5ody69ICtROUeimntYdqfdi 8rxok1eBnBQO1pTwkNu4i+UIr4VKFcPebjHQsXz83MSwKViFMX8FMsXOfuBGE1rP L660zIhWs3QxeUmwnnKZItOmDvLVVKuHBvH0T3TAwFy8c2ju1Bzf+lDSpNize2Oy sH3elVO1L2J6ZLOM4SQ6RsjIXCM43Tiv9Zcbtwi2Bh1e9WgP8gUOu5g4x7Sucm2J cLUxF7GGxF1lF65oEhVp+In1jv6Z5ixg8yp4HewdFT7c9mGpqD8bXr77yPwBqn8B 7xUOmGJNo+PcWTxK1b1A01nQiQQ0qj+cD8nlhLT+jYORFhP4lHPLm7WeRjc6YWvA wtzrCDBdLwJLVI7JaCP6idCxBC21gJZrsiP9FzDfppJUA7hE+8QROTPFsoU0EFrt UmFD8p7HKvxRPNKOEJYQCpCro9YXZP0TVV7GoqNHMIslgDpqIc8OtBCcfRpwbmln PLgnHHzsppZQruavzlNhUkx09gwHPaHnPJKw8ZdAyfMnia4D6aFMoR27l14huk6m DOP8T0CBSDXNxxiRwqYa =SGXF -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlSpOxsACgkQR6LMutpd94xr1wCgh5qaxdNVmu62BaPxsqo3O9bK bhoAn1Qg2ei1QWeDtLLsAAmt4YWGABXI =6tvF -----END PGP SIGNATURE-----
On 2015-01-04 14:07, Andrei Borzenkov wrote:
В Sun, 04 Jan 2015 12:34:53 +0200 "I.Petrov" <> пишет:
Hello,
Actually I didn't know that the asterisks can be used for highlighting in the mailing list. Anyway, the asterisks (at least this in front of the directory name e.g. *cur) are *required* in the command line in order the directories to be omitted.
That's true, because you used -path. But if you want to match every directory nameed "cur" using -name is more simple (and probably slightly more efficient). -path is usually useful when you want to match one specific instance of given name only.
Sorry for the confusion.
Then I'm confused. I get: cer@Telcontar:~> find $HOME/Mail/maildir -type d -path *cur* -prune -o -path *new* -prune -o -path *tmp* -prune -o -path *courierimapkeywords* -prune -o -print find: paths must precede expression: newfile1.txt Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression] cer@Telcontar:~> -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar)
Carlos, et al -- I have been totally loving this thread. Thank you, Hylton, for so much fun! :-) ...and then Carlos E. R. said... % % On 2015-01-04 14:07, Andrei Borzenkov wrote: % > ?? Sun, 04 Jan 2015 12:34:53 +0200 "I.Petrov" <> ??????????: % > ... % >> directory name e.g. *cur) are *required* in the command line in order the directories to be omitted. % > % > That's true, because you used -path. But if you want to match every ... % > % > Sorry for the confusion. % % Then I'm confused. I get: % % cer@Telcontar:~> find $HOME/Mail/maildir -type d -path *cur* -prune -o -path *new* -prune -o -path *tmp* -prune -o -path *courierimapkeywords* -prune -o -print Gotta love long lines with no backslashes, right? :-) [Hylton, in addition to agreeing with Anton et al that you need to enjoy -- yes, enjoy! -- some serious time with the sh man page, tutorials on the web, and even a good book, I'd say that 90% of your problems are because you're using a GUI mailer that tries to be smart and reformat lots of things for you. In a case like this, you want as little alteration as possible.] % find: paths must precede expression: newfile1.txt % Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression] Try that in a directory with no files. Try that in a directory with a file (or dir) called 'cur'. Try that after first running 'set noglob'. Or, as you discovered, put the splats in quotes (of either type, although I'd personally use singles in this case) to protect the params from shell expansion. Never boring :-) Happy New Year :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Am 03.01.2015 um 01:19 schrieb I.Petrov:
Hello,
The command in your case should be:
find $HOME/Maildir -type d -path *cur* -prune -o -path *new* -prune -o -path *tmp* -prune -o -path *courierimapkeywords* -prune -o -print
You should put quotes around the "*...*" just in case you have a matching file in the current folder. And I'm not sure about the last "-o". Wouldn't that print in any case? find $HOME/Maildir -type d \ -path "*cur*" -prune \ -o -path "*new*" -prune \ -o -path "*tmp*" -prune \ -o -path "*courierimapkeywords*" -prune \ -print Regards, -- Aaron "Optimizer" Digulla a.k.a. Philmann Dark "It's not the universe that's limited, it's our imagination. Follow me and I'll show you something beyond the limits." http://blog.pdark.de/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2015-01-04 13:14, Aaron Digulla wrote:
Am 03.01.2015 um 01:19 schrieb I.Petrov:
Hello,
The command in your case should be:
find $HOME/Maildir -type d -path *cur* -prune -o -path *new* -prune -o -path *tmp* -prune -o -path *courierimapkeywords* -prune -o -print
You should put quotes around the "*...*" just in case you have a matching file in the current folder.
Ah! Yep. Without them I get an error.
And I'm not sure about the last "-o". Wouldn't that print in any case?
find $HOME/Maildir -type d \ -path "*cur*" -prune \ -o -path "*new*" -prune \ -o -path "*tmp*" -prune \ -o -path "*courierimapkeywords*" -prune \ -print
It is needed. Without it the output is empty: cer@Telcontar:~> find $HOME/Mail/maildir -type d -path "*cur*" -prune -o -path "*new*" -prune -o -path "*tmp*" -prune -o -path "*courierimapkeywords*" -prune -o -print /home/cer/Mail/maildir cer@Telcontar:~> cer@Telcontar:~> find $HOME/Mail/maildir -type d -path "*cur*" -prune -o -path "*new*" -prune -o -path "*tmp*" -prune -o -path "*courierimapkeywords*" -prune -print cer@Telcontar:~> -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar)
participants (12)
-
Aaron Digulla
-
Andrei Borzenkov
-
Anton Aylward
-
Carlos E. R.
-
David T-G
-
Florian Gleixner
-
Hylton Conacher (ZR1HPC)
-
I.Petrov
-
Luuk
-
Patrick Shanahan
-
Per Jessen
-
Yamaban