You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@zeppelin.apache.org by Fernando Barreiro Lostres <fb...@sonoc.io> on 2022/02/24 15:19:27 UTC

Help with shell command syntax

Hello all:

I'm executing a command in Zeppelin via the %sh interpreter to count 
files on a remote server matching a date template inside the file name.

I'm trying to find the right syntax to parameterize it, in a way I can 
easily change the date in the filename without needing to change the code.

My actual command is:

%sh
ssh user@server.com 'sudo find /folder_path -type f | grep  -oP 
"file-name-202202\d{2}" | sort | uniq -c'

I want to achieve this:

ssh user@server.com 'sudo find /folder_path -type f | grep  -oP 
"file-name-${parameter}" | sort | uniq -c'


Please, could you help me to achieve that?

Thanks in advance,



Fernando Barreiro
Software developer
www.sonoc.io
This e-mail is for the exclusive use of its recipients and may contain business secrets or other confidential or privileged information. Any unauthorised use, copying, publication or distribution of this e-mail is strictly prohibited. If you are not the intended recipient, please inform us immediately by replying to this e-mail and delete it, including any attachments or copies on your system.
​
In accordance with the GDPR (EU) 2016/679 and the LOPDGDD 3/2018, we inform you that this e-mail address and/or any other personal data you have provided us with will be treated by SONOC with absolute confidentiality and with the only purpose of providing you with the requested services, due to your condition as a client, supplier or because you have requested information from us at any time. These data will only be kept for as long as required to comply with legal obligations. You can exercise your rights at any time by sending an e-mail to: dataprotection@sonoc.io.

Re: Help with shell command syntax

Posted by Jeff Zhang <zj...@gmail.com>.
Hi Fernando,

To be honest, this question is not related to Zeppelin, it's better to ask
this kind of question in stackoverflow.

On Thu, Feb 24, 2022 at 11:19 PM Fernando Barreiro Lostres <
fbarreiro@sonoc.io> wrote:

> Hello all:
>
> I'm executing a command in Zeppelin via the %sh interpreter to count
> files on a remote server matching a date template inside the file name.
>
> I'm trying to find the right syntax to parameterize it, in a way I can
> easily change the date in the filename without needing to change the code.
>
> My actual command is:
>
> %sh
> ssh user@server.com 'sudo find /folder_path -type f | grep  -oP
> "file-name-202202\d{2}" | sort | uniq -c'
>
> I want to achieve this:
>
> ssh user@server.com 'sudo find /folder_path -type f | grep  -oP
> "file-name-${parameter}" | sort | uniq -c'
>
>
> Please, could you help me to achieve that?
>
> Thanks in advance,
>
>
> <http://www.sonoc.io/>
> Fernando Barreiro​
> Software developer
> *www.sonoc.io* <http://www.sonoc.io/>
> [image: LinkedIn] <https://www.linkedin.com/company/sonoc>
> [image: Twitter] <https://twitter.com/sonoc_>
> [image: Facebook] <https://www.facebook.com/SONOCio/>
> This e-mail is for the exclusive use of its recipients and may contain
> business secrets or other confidential or privileged information. Any
> unauthorised use, copying, publication or distribution of this e-mail is
> strictly prohibited. If you are not the intended recipient, please inform
> us immediately by replying to this e-mail and delete it, including any
> attachments or copies on your system.
> ​
> In accordance with the GDPR (EU) 2016/679 and the LOPDGDD 3/2018, we
> inform you that this e-mail address and/or any other personal data you have
> provided us with will be treated by SONOC with absolute confidentiality and
> with the only purpose of providing you with the requested services, due to
> your condition as a client, supplier or because you have requested
> information from us at any time. These data will only be kept for as long
> as required to comply with legal obligations. You can exercise your rights
> at any time by sending an e-mail to: *dataprotection@sonoc.io*
> <da...@sonoc.io>*.* <da...@sonoc.io>
>


-- 
Best Regards

Jeff Zhang