holzschu / a-shell

A terminal for iOS, with multiple windows
BSD 3-Clause "New" or "Revised" License
2.61k stars 116 forks source link

[iphone] I want to search for files and compress them. #459

Open mamanngaga01 opened 2 years ago

mamanngaga01 commented 2 years ago

file folder test 1.jpeg 10.jpeg 100.jpeg 250.jpeg 1000.jpeg

find . -type f | xargs grep . -e '[0-9]' >test.txt find . -type f | xargs grep . -e '[0-9]{1,3}' >test.txt "{}" symbols in regular expressions are not reflected.

find . -name "*" | xargs grep . -e (?<![0-9])(?:200|[1][0-9]{2}|[1-9][0-9]|[0-9])(?![0-9]) >test.txt "[0-9])(?![0-9]): command not found"

It will look like this.

zip: command not found "zip.wasm" Download this and put it in the test folder. "*"This doesn't seem reflected.

zip.wasm test.zip "*.jpeg" zip error; Nothing to do! (test.zip)

Anyway how can I compress a jpeg up to 250 with command?

holzschu commented 2 years ago

Based on my tests, zip.wasm test.zip *.jpg should work (no quotes around the *.jpg).

Then again, it's unlikely that zip manages to compress jpg files, but that's not your question. If you want to create an archive with all jpeg files up to 250 in your example, I would use zip.wasm test.zip ???.jpeg ??.jpeg ?.jpeg

mamanngaga01 commented 2 years ago

zip.wasm test.zip *.jpg Thank you. All jpegs in a folder could be compressed into one. "zip.wasm test.zip ???.jpeg ??.jpeg ?.jpeg" You can do this, but it will be difficult.

Download images for cartoon sites. Then it will look like this.

random alphanumeric001.jpeg random alphanumeric002.jpeg random alphanumeric003.jpeg

That's why I want to search. If you compress everything, the order will be out of order. I would like to use "find & grep" in the command, but it was not reflected well. I was in trouble because the command I asked first did not work well. '[0-9]{1,3}' Regular expressions are not reflected. "[0-9])(?![0-9]): command not found" The command is halfway. What should I do?

holzschu commented 2 years ago

I'm not sure about what you want to do, but I would either try it inside dash, a newly added shell that has better regexp parsing (type dash) or just with find: find . -type f -name random\ alphanumeric[1-9].jpeg, rather than find + xargs.

mamanngaga01 commented 2 years ago

After confirmation, we will delete the URL.

create test folder "zip.wasm" insert https://www.icloud.com/shortcuts/

https://kmansin09.com/bbs/board.php?bo_table=2001&wr_id=1810&spage=18

I can't use regular expressions well in a crowded way. Depending on the site, the image url is just in order at the end. How can I do the regex as a smart way?

mamanngaga01 commented 2 years ago

[0-9] \d This has the same meaning in regular expressions. But this "shortcut" seems to have a different meaning.

'[0-9]{1,3}' Normally this is applied, but it is not applied with a-shell.

find . -name "*" | xargs grep . -e (?<![0-9])(?:200|[1][0-9]{2}|[1-9][0-9]|[0-9])(?![0-9]) The command I wrote at the beginning is separated in the middle.

I don't know if the a-shell regular expression is wrong. Shortcuts increase man-hours. find ■■ ■■ | grep ■■ ■■ | zip.wasm ■■.zip ■■ Is it not possible to use regular expressions in this way?

holzschu commented 1 year ago

I still have problems understanding what you are trying to do, but from a few tests, I think you need to use the "grep -E" option, instead of "-e". I'm also not certain why you used xargs in this specific scenario.

With a directory with the same files as you listed in your first post, find -name "*" | grep -e [0-9]{1,3} returns nothing, but find -name "*" | grep -E [0-9]{1,3} returns all files. And find -name "*" | grep -E /[0-9]{1,3}.jpg returns all files that are 1 to 3 digits long, which is, I think, what you were trying to do.

find . -name "*" | grep -E "(?<![0-9])(?:200|[1][0-9]{2}|[1-9][0-9]|[0-9])(?![0-9])" (with double quotes around the argument) returned "grep: repetition-operator operand invalid", which is not working but probably an error message that can help you. Without the double quotes, a-Shell thinks you are trying to pipe the command into [0-9])(?![0-9]).

mamanngaga01 commented 1 year ago

Smartphones are prevalent. As a result, the vertical reading of manga has increased. Download the image using "Beautiful Soup" from the site. The name of the image is random, but the end is 001.jpeg. Search and sort images and save to zip. I wanted to be able to read vertically in another app. So I wanted to search for files using regular expressions, but it didn't work. Thank you for your reply.