Highlighted

grep move date to back

Community Beginner ,
Aug 26, 2020

Copy link to clipboard

Copied

I have a text with a compound list with a start date and a small variable text (a title). With grep can I move the date to the end? What?

Adobe Community Professional
Correct answer by vladan saveljic | Adobe Community Professional

Peter surely will give you better solution but in the meantime try this grep:

 

Find

^(\d+)(\s)(.+)
change with
$3$2$1

 

This grep is based exclusively on the example you provided.
If there are other variables in your text, let us know with another example

TOPICS
How to

Views

88

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

grep move date to back

Community Beginner ,
Aug 26, 2020

Copy link to clipboard

Copied

I have a text with a compound list with a start date and a small variable text (a title). With grep can I move the date to the end? What?

Adobe Community Professional
Correct answer by vladan saveljic | Adobe Community Professional

Peter surely will give you better solution but in the meantime try this grep:

 

Find

^(\d+)(\s)(.+)
change with
$3$2$1

 

This grep is based exclusively on the example you provided.
If there are other variables in your text, let us know with another example

TOPICS
How to

Views

89

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 26, 2020 0
Adobe Community Professional ,
Aug 26, 2020

Copy link to clipboard

Copied

If you show an example so that we can see what format the date is, maybe you get a working solution.

P.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 26, 2020 0
Community Beginner ,
Aug 26, 2020

Copy link to clipboard

Copied

758 Text1 abcd bla blabla bla

1050 Text2 balska ababab abaababbb

1751 Text3 sljsda sbabab abababa

2020 Text4 ada daadfa adfafa  dafaba b bababb

...

I wanted to transform like this

 

Text1 abcd bla blabla bla 758

Text2 balska ababab abaababbb 1050

Text3 sljsda sbabab abababa 1751 

Text4 ada daadfa adfafa  dafaba b bababb 2020

...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 26, 2020 0
Adobe Community Professional ,
Aug 26, 2020

Copy link to clipboard

Copied

Vladan's solution works fine. Just one thing: if there's any formatting it'll be messed up.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 26, 2020 2
Most Valuable Participant ,
Aug 26, 2020

Copy link to clipboard

Copied

Yep. If there is any local formatting at all, it'll disappear or – possibly worse – remain in place while the text gets shifted.

If your text contains local formatting, it'll need a script to do this safely.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 26, 2020 2
Adobe Community Professional ,
Aug 26, 2020

Copy link to clipboard

Copied

Yes, of course I agree, but as I wrote before, I have proposed grep based on his example without thinking of possible variables that maybe there are in his text or maybe there aren't.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 26, 2020 1
Adobe Community Professional ,
Aug 26, 2020

Copy link to clipboard

Copied

Peter surely will give you better solution but in the meantime try this grep:

 

Find

^(\d+)(\s)(.+)
change with
$3$2$1

 

This grep is based exclusively on the example you provided.
If there are other variables in your text, let us know with another example

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 26, 2020 2