/tech/ - Technology

Where proprietary software comes to die

Posting mode: Reply

Name
Email
Subject
Comment
Password
Drawing x size canvas
File(s)

Remember to follow the rules

Max file size: 350.00 MB

Max files: 5

Max message length: 4096

Manage Board | Moderate Thread

Return | Catalog | Bottom

Expand All Images


(90.75 KB 350x350 R-9832721.jpg)
Anonymous 02/23/2017 (Thu) 19:48:21 [Preview] No. 8097
I'm trying to do something but I don't know the right tool for it.
I want to get the page number from lsw and store it in a file. In this case number 96
This is an example output.
0x1a00005 st
0x180000a the.pdf - 96/181 (96 dpi)
I'm thinking of grep and regex but I've never properly used grep and seems like something too big for such a simple task.


Anonymous 02/24/2017 (Fri) 20:51:45 [Preview] No. 8109 del
>>8097
Hard to tell with that little info.
sed -n 's:.*\.pdf - \([0-9][0-9]*\)/[0-9].*:\1:p'


Anonymous 02/24/2017 (Fri) 22:31:05 [Preview] No. 8112 del
I actually did it with:
grep -e 'dpi' | sed 's=.*- ' | sed 's=/.*'
but yours is way better. Thank you.


Anonymous 02/24/2017 (Fri) 22:34:20 [Preview] No. 8113 del
>>8112
For some reason lynx fucked up that paste.
I basically narrowed down the line looking for dpi since, the removed everything in fron of "- " and everything after "/"


Anonymous 02/25/2017 (Sat) 04:18:51 [Preview] No. 8114 del
>>8113
>For some reason lynx fucked up that paste.
It was not lynx. It was the 2 = in a row, which does RED TEXT. You should use code tags.
http://endchan5doxvprs5.onion/.static/posting.html


Anonymous 02/25/2017 (Sat) 04:28:43 [Preview] No. 8115 del
(22.46 KB sed.pdf)
>>8112
You do not need to pipe grep into sed or sed into sed like that. You can give multiple commands to sed.



Top | Return | Catalog | Post a reply