Search Results

Search: Posts Made By: Neo
4,713
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,713
Posted By Neo
Good for you and happy learning! BTW, I...
Good for you and happy learning!

BTW, I tried that solution you just posted and had trouble when testing; but I was in a rush coding other projects so I guess I missed it somehow, maybe misplaced...
4,713
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,713
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,713
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,...
4,713
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,713
Posted By Neo
Yes, I see that now.... sorry busy working on...
Yes, I see that now.... sorry busy working on apache2 error.... missed that (your output versus input)... my bad.

Will test something on my mac and post back.
4,713
Posted By Neo
Deleted post because my comment was accidentally...
Deleted post because my comment was accidentally on the output and not the input.

See my post below specific to macos and using perl instead of sed or using gsed on macos.

Earlier sed code...
4,713
Posted By Neo
Did you try something simple like? sed...
Did you try something simple like?


sed 's/, name/\nname/g' yourfile.txt

ubuntu$ sed 's/, name/\nname/g' yourfile.txt
name:Pages, path:/Applications/Pages.app, class:login item,...
Showing results 1 to 9 of 9

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