LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 03-08-2021, 09:00 AM   #16
Gebby_3
Member
 
Registered: Feb 2021
Location: Beverly, MA
Posts: 57

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by Gebby_3 View Post
That syntax left the line unchanged.

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
 
Old 03-08-2021, 09:10 AM   #17
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,616

Rep: Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554
Quote:
Originally Posted by Gebby_3 View Post
This works but I am trying to simulate with sed (GNU sed version 3.02)
(Gawk GNU Awk 3.1.0)
GNU Awk 3.1 is from 2002 and sed 3.0.2 was released in 1998!!

I refer again to my previous recommendation: ditch MKS Toolkit and just use MinGW (either via MSys2 or Git).

Then you will get current versions - and almost certainly the bug in Sed causing your problem will be solved.


Last edited by boughtonp; 03-08-2021 at 09:12 AM.
 
Old 03-08-2021, 10:08 AM   #18
Gebby_3
Member
 
Registered: Feb 2021
Location: Beverly, MA
Posts: 57

Original Poster
Rep: Reputation: Disabled
Latest Versions

Quote:
Originally Posted by boughtonp View Post
GNU Awk 3.1 is from 2002 and sed 3.0.2 was released in 1998!!

I refer again to my previous recommendation: ditch MKS Toolkit and just use MinGW (either via MSys2 or Git).

Then you will get current versions - and almost certainly the bug in Sed causing your problem will be solved.

I will update my setup with GIT
 
Old 03-08-2021, 11:24 AM   #19
Gebby_3
Member
 
Registered: Feb 2021
Location: Beverly, MA
Posts: 57

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Gebby_3 View Post
I will update my setup with GIT
Sorry. Older ver was my sed problem.
sed 4.0.7 worked fine.
My cygwin\bin ver won't work in my TCC shell but my UnixUtl\bin ver 4.0.7 works.

I know you mentioned that before.

I will see if GIT works in my TCC shell next.

--Thanks
 
Old 03-08-2021, 11:44 AM   #20
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,616

Rep: Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554

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.

 
1 members found this post helpful.
Old 03-08-2021, 06:18 PM   #21
Gebby_3
Member
 
Registered: Feb 2021
Location: Beverly, MA
Posts: 57

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by boughtonp View Post
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......
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] [bash][sed] replace string after fixed string/character? czezz Programming 4 02-15-2022 01:35 PM
sed search for a string, duplicate original and replace the string Jykke Programming 17 06-29-2016 10:14 AM
Trying to use sed to replace a number that is in a string with a word simpsonc Linux - Newbie 3 09-12-2010 07:55 PM
how do i replace a text string in a file with a random string? (with sed etc) steve51184 Linux - Software 16 09-02-2010 11:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration