Menu
News
All News
Dungeons & Dragons
Level Up: Advanced 5th Edition
Pathfinder
Starfinder
Warhammer
2d20 System
Year Zero Engine
Industry News
Reviews
Dragon Reflections
Columns
Weekly Digests
Weekly News Digest
Freebies, Sales & Bundles
RPG Print News
RPG Crowdfunding News
Game Content
ENterplanetary DimENsions
Mythological Figures
Opinion
Worlds of Design
Peregrine's Next
RPG Evolution
Other Columns
From the Freelancing Frontline
Monster ENcyclopedia
WotC/TSR Alumni Look Back
4 Hours w/RSD (Ryan Dancey)
The Road to 3E (Jonathan Tweet)
Greenwood's Realms (Ed Greenwood)
Drawmij's TSR (Jim Ward)
Community
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Resources
Wiki
Pages
Latest activity
Media
New media
New comments
Search media
Downloads
Latest reviews
Search resources
EN Publishing
Store
EN5ider
Adventures in ZEITGEIST
Awfully Cheerful Engine
What's OLD is NEW
Judge Dredd & The Worlds Of 2000AD
War of the Burning Sky
Level Up: Advanced 5E
Events & Releases
Upcoming Events
Private Events
Featured Events
Socials!
Twitch
YouTube
Facebook (EN Publishing)
Facebook (EN World)
Twitter
Instagram
TikTok
Podcast
Features
Top 5 RPGs Compiled Charts 2004-Present
Adventure Game Industry Market Research Summary (RPGs) V1.0
Ryan Dancey: Acquiring TSR
Q&A With Gary Gygax
D&D Rules FAQs
TSR, WotC, & Paizo: A Comparative History
D&D Pronunciation Guide
Million Dollar TTRPG Kickstarters
Tabletop RPG Podcast Hall of Fame
Eric Noah's Unofficial D&D 3rd Edition News
D&D in the Mainstream
D&D & RPG History
About Morrus
Log in
Register
What's new
Search
Search
Search titles only
By:
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Menu
Log in
Register
Install the app
Install
Community
General Tabletop Discussion
*Geek Talk & Media
Anyone still using 'sed'? I need guidance
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="rom90125" data-source="post: 2946133" data-attributes="member: 17111"><p>I'm a windows-based programmer who has recently been given the task of adding some simple functionality to a sister company product that is written in C and running on Fedore Project. My task is to modify the contents of a text file.</p><p></p><p>The data in the file is structured so that each unique value is delimited by the character |; as such:</p><p></p><p>value1|value2|value3|value4|value5|value6</p><p></p><p>it is possible that zero to all of the values could be null, in which case the data could look like this:</p><p>value1||value3|value4|value5|</p><p></p><p><strong>The question is this: Using sed, is there a way to replace data between two specific delimiters in the string?</strong> For example, I want to completely replace the substring 'value4' with the string 'hereWeGo', as such:</p><p></p><p>value1|value2|value3|hereWeGo|value5|value6</p><p></p><p>or in the case of there being no data is this place, add it. See below;</p><p>BEFORE -> value1||value3||value5|value6</p><p>AFTER -> value1||value3|hereWeGo|value5|value6</p></blockquote><p></p>
[QUOTE="rom90125, post: 2946133, member: 17111"] I'm a windows-based programmer who has recently been given the task of adding some simple functionality to a sister company product that is written in C and running on Fedore Project. My task is to modify the contents of a text file. The data in the file is structured so that each unique value is delimited by the character |; as such: value1|value2|value3|value4|value5|value6 it is possible that zero to all of the values could be null, in which case the data could look like this: value1||value3|value4|value5| [b]The question is this: Using sed, is there a way to replace data between two specific delimiters in the string?[/b] For example, I want to completely replace the substring 'value4' with the string 'hereWeGo', as such: value1|value2|value3|hereWeGo|value5|value6 or in the case of there being no data is this place, add it. See below; BEFORE -> value1||value3||value5|value6 AFTER -> value1||value3|hereWeGo|value5|value6 [/QUOTE]
Insert quotes…
Verification
Post reply
Community
General Tabletop Discussion
*Geek Talk & Media
Anyone still using 'sed'? I need guidance
Top