2

I have a problem thatI can not solve even after scanning the Web. I trust in your help.

I have a text file that contains several strings of different lengths.

https: //insidemiamitatto.com/gugwywgifuw '";
https://insidemiamitatto.com/gugyiwyeiuiuweyiweyi '";
https://insidemiamitatto.com/gugyiipi9uuuppopi '";

I need to eliminate with Applescript or Terminal the last 3 characters, i.ee '";

I tried it with sed, but my invocation eliminates the characters only from the longer strings, leaving the others with 3 characters.

Is there a way to eliminate the final 3 characters in each string?


I also have a second question:

Always with sed I can remove strings e.g:

sed -i.bak -e '1,200d; 1874,2842d'

This virtually eliminates a part of the initial and final text.

In the rest of the files, I string groups that alternate every 18 strings, and I would like to erase 17 in each group, for example:

1-18 19-37 38-55.

I would keep the strings 1 19 38.

Is sed or other feasible? I am using BBEdit, but every time I have to count manually, and it is exhausting when editing many files.

Edit:

I explained bad .... Sorry

Es.

lol//www.ilbelpaese.com/guyg66tugudg/img.png

lol//www.ilbelpaese.com/guyg66tugudg/img.png

lol//www.ilbelpaese.com/guyg66tugudg/img.png

lol//www.ilbelpaese.com/guyg66tugudg/img.png

——————————

lol//www.ilbelpaese.com/guyg66tugudg/img.png

lol//www.ilbelpaese.com/guyg66tugudg/img.png

lol//www.ilbelpaese.com/guyg66tugudg/img.png

lol//www.ilbelpaese.com/guyg66tugudg/img.png

——————————

I would like to delete all the rows ——————————

and sed there is a way to insert blank lines?

1 Answer 1

1

To delete last 3 characters of each line:

sed -e 's/...$//'

For the second part:

$ echo "1-18 19-37 38-55" | sed -E 's/([0-9]+)-[0-9]+ ?/\1 /g'

1 19 38

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .