Search Results

Search: Posts Made By: 7adi
4,588
Posted By Neo
This does not work as you need. You forgot to...
This does not work as you need. You forgot to add the colon (:) back in the REGEX:

sed 's/, name:/\'$'\nname:/g'

So,

macos$ sed 's/, name:/\'$'\nname:/g' test.txt > a.txt

macos$ cat...
4,588
Posted By Neo
That works from the shell command line for sure. ...
That works from the shell command line for sure.

But, I don't think the original poster wants to necessarily force a line break like that into his sequence of commands, when their are clearly...
4,588
Posted By Neo
Welcome. I think you will have some trouble...
Welcome.

I think you will have some trouble with sed on the mac. I checked the web, and this newline issue on the macos version of sed is very frustrating for many people . The best idea for...
4,588
Posted By Neo
I think on macos, perl is a better choice (for...
I think on macos, perl is a better choice (for this REGEX):

macos$ perl -p -e 's/name:/\nname:/g' test.txt > a.txt

macos$ cat test.txt a.txt
name:Pages, path:/Applications/Pages.app,...
4,588
Posted By Neo
Also, FYI.. on macOS, you can also install GNU...
Also, FYI.. on macOS, you can also install GNU sed and it works as expected:

brew install gnu-sed

macos$ gsed 's/name:/\nname:/g' test.txt > a.txt
macos$ cat test.txt a.txt
name:Pages,...
Showing results 1 to 5 of 5

 
All times are GMT -4. The time now is 04:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy