[SOLVED] use sed to swap text in a string (not replace)
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
This works but I am trying to simulate with sed (GNU sed version 3.02)
(Gawk GNU Awk 3.1.0)
gawk -F" - " "$0=$2FS$1" input file > output file
I am also trying to use SpellCheck but need to know how to implement this sed syntax and see the results.
SpellCheck
Load Random Example
#!/bin/bash
file1$ "left - right"
sed "s/\(.*\) - \(.2\)/\2 - \1/" file1$ > file2$
echo file2$
Syntax ok but how can I display the results here?
Please keep in mind I'm pretty green at RegEx
I am referencing all the suggested material given for help.
Last edited by Gebby_3; 03-08-2021 at 09:28 AM.
Reason: Clarification
Yep, I was fairly sure it would - I've used Sed enough on Windows and never had problems with the line ending problem, but it's not surprising that such an old version does.
Also, for clarity, what you're referring to as "GIT" is "Git for Windows", which is a bundle that includes multiple things: Git version control, GNU Bash shell, and mingw-w64 (which provides GNU coreutils and others) - referring to it as either "Git Bash" or "MinGW" should be less confusing.
Yep, I was fairly sure it would - I've used Sed enough on Windows and never had problems with the line ending problem, but it's not surprising that such an old version does.
Also, for clarity, what you're referring to as "GIT" is "Git for Windows", which is a bundle that includes multiple things: Git version control, GNU Bash shell, and mingw-w64 (which provides GNU coreutils and others) - referring to it as either "Git Bash" or "MinGW" should be less confusing.
Yes, I got the Git for windows and extracted the portable version. Has all & more than I most likely will ever need.
This gets me over my major hurdles and ready for my next minor steps.
--Thanks to All that helped. So far the best help forum I've encountered and it's funny to see some of the same advisors on the other forums!
Glad we have people out there taking their time helping us green horns.
You haven't heard the last from me......
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.