Visit Our UNIX and Linux User Community

Substitute a character with sed

Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Substitute a character with sed
# 15  
Old 03-15-2019
Yes, /usr/bin/perl -> perl5 should be everywhere. But do not expect certain perl modules!
# 16  
Old 03-15-2019
When I was working at Sun, you could set PATH to include various *bin directories in various different orders to get an environment that met the requirements of several standards including (but not limited to) SVID3, XPG3, XPG4, XPG5, SUSv1, SUSv2, each of the revisions of the POSIX.1 and POSIX.2 standards (and most of the other POSIX standards except for POSIX.3), and also some versions of BSD and UNIX System V.

I make no claims about what has happened to that guaranteed backwards compatibility between releases since Oracle bought out Sun. (It may still work, I just don't know.)

If you don't consider shell and awk to be programming languages, the POSIX standards do still provide the C programming language. The current version of the POSIX standards are built on top of the 1999 ISO C Standard. The next revision of the POSIX standards will be built on top of the 2011 or 2017 C standard (depending on whether the Austin Group or the ISO C committee gets their next revision ready first. At one time there were POSIX working groups working on Ada and C++ bindings to POSIX.1, but those groups are no longer active. The Austin Group does still work closely with both the ISO C and ISO C++ working groups and although there is no C++ compiler specified in the POSIX.2 standard, the ISO C++ standard libraries are intended to be fully compatible with the POSIX.1 standards.

I was once offered up as a sacrificial lamb to attend some meetings helping to define standards for the Linux operating system. I was immediately deemed to be an enemy of everything that committee wanted to do. I believed that standards were created to help users write portable code; everyone else in the room thought standards were written to constrain operating systems development. Where the SVID, XPG, SUS, and POSIX standard specified requirements that conforming operating systems had to supply; the LSB (Linux Standards Base) went a different way. The LSB defined the names of some functions that the Linux operating system had to supply, but only gave very brief descriptions of what those functions did. The definition of how those functions behaved is defined by the source code for the Linux operating system; not by any document that an applications programmer could use to determine how to write a portable application that would run on any Linux system. If you write an application that conforms to the LSB and it works on one Linux system today, there is no guarantee that it will work on any Linux operating system tomorrow.

That was twenty-five years ago. Today, some Linux vendors actively participate in the Austin Group and try to mostly comply with POSIX requirements. (Note mostly; not completely. No Linux vendor has gotten a POSIX or UNIX certification demonstrating that their implementation passes the verification suites testing conformance to the POSIX standards nor the Single UNIX Specifications yet.)

Note that all of the above is my own biased opinion. Other people may well have different opinions.

Last edited by Don Cragun; 03-19-2019 at 09:12 AM.. Reason: Fix typo s/Linus/Linux/
This User Gave Thanks to Don Cragun For This Post:
# 17  
Old 03-19-2019
Thanks all for the participation.

I hope I did not make my statements in the way they are the truth, but just did show them as my own preferences(e. g. the statement that "Shell scripting is now programming language") . Others may have other preferences. (@Bakunin: I'm sure you have a great script library of portable scripts he can use when he needs them in any environment).

In overall my views have not changed. Portability may be an important goal in writing scripts. But one does not get it for free. And it's not cheap, because it impacts other objectives one might have in programming, which may be...
  • Ease of programming
  • Efficiency of Resources
  • Security
  • Robustness
  • Maintainability/Readability
  • Slim Programming Runtime Environment

But one can do easy things to keep portability and need not to break it lightly (Using BRE instead of ERE,...).

Despite being a bit interested in standardization, I was only reading news about that topic here and there. Thanks for the details Don. I gave up on that 20 years ago. Linux is absolutely great in terms of standardization like every distribution has it's own standard. (See xkcd: Standards). Just kidding. The linux folks are not even able to get together in which file the hostname of the system should reside. In the end the decision was made by using systemd which had it at the fixed location /etc/hostname.

In all my time it has never come to a common way e. g. to configure persistent networking. There are about 50 different ways to do it.

Originally Posted by jim mcnamara
Speaking strictly as a scientist: python ruby, and julia are extremely important for research and analysis.
I do not know that. But I assume, you know what you are speaking of. The question for me is, what is needed as a runtime which is needed as a base - as a compatibility layer. I think it's not that good to have 100 GB of every possible and well working programming language installed in every system. I would rather like to have that base not too fat.

Last edited by stomp; 03-21-2019 at 02:50 PM..

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed substitute command -- need help

I am trying to do what I thought should be a simple substitution, but I can't get it to work. File: Desire output: I thought I'd start with a sed command to remove the part of the header line preceding the string "comp", then go on to remove the suffix of the target string (e.g. ":3-509(-)"),... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

2. Shell Programming and Scripting

How to substitute variable in sed for special character?

Hi , I have input file like below Hi this is "vinoth". Hi happy to work with 'unix' USA(united states of America) My script variables are below : Dquote=Ộ Squote=&#$567 Obrac=&^986 Cbrac=&^745 I want to read the variables in my SED command to replace the double quote,single... (9 Replies)
Discussion started by: vinothsekark
9 Replies

3. Shell Programming and Scripting

using sed or gsub to substitute characters!

Is there a way to substitute the URL-encoding references of ( & and ` ) with their actual appearance? for example.... %26 is & say I want to convert every %26 in my file to &..... awk '{gsub(/%26/,"&");print}' Is there a way to do this? I also want to be able to convert ` too! (3 Replies)
Discussion started by: puttster
3 Replies

4. Shell Programming and Scripting

Sed question to substitute data in \2

Hi All, Here is what I'm trying to do with sed: Input File: somechangeVariable1=Something I would like to change somechangeVariable2=Something else I would like to change ... Output File: somechangeVariable1=Something I would like to different somechangeVariable2=Something else I would... (6 Replies)
Discussion started by: Peace_Dude1
6 Replies

5. UNIX for Dummies Questions & Answers

Using sed to substitute between quotes.

I'm using sed to perform a simply search and replace. The typical data is: <fig><image href="Graphics/BAV.gif" align="left" placement="break" I need to replace the value in the first set of quotes, keeping the remainder of the line the same. Thus: <fig><image href="NEW_VALUE" align="left"... (3 Replies)
Discussion started by: Steve_altius
3 Replies

6. Shell Programming and Scripting

Using sed to substitute first occurrence

I am trying to get rid of some ending tags but I run into some problems. Ex. How are you?</EndTag><Begin>It is fine.</Begin><New> Just about I am trying to get rid of the ending tags, starts with </ and ending with >. (which is </EndTag> and </Begin>) I tried the following sed... (2 Replies)
Discussion started by: quixoticking11
2 Replies

7. AIX

check for a particular character inside a file and substitute with a given character?

i am a newbie to shell script,so i want a kshell script in which i need to check for a particular character inside a file through conditional looping(like if ,case,while)and if that character exists ,then substitute a given character to that character. consider a file test.txt,inside the file... (1 Reply)
Discussion started by: karthikprasathk
1 Replies

8. Shell Programming and Scripting

Using SED to substitute between two patterns.

Hi All, I'm currently using SED to make various changes to some .xml files I'm working on, but I'm stuck on this particular problem. I want to remove '<placeholder>element-name</placeholder>' from the following: <heading>Element <placeholder>element-name</placeholder> not... (2 Replies)
Discussion started by: Steve_altius
2 Replies

9. UNIX for Dummies Questions & Answers

read a variable character by character, substitute characters with something else

im having trouble doing this: i have a variable with 2 characters repeating e.g. aababbbaaaababaabbaabbba is there a way i can search the variable for a's and b's and then change a's to b's and b's to a's? im guessing its like getting the 1's compliment of the string im doing this in... (2 Replies)
Discussion started by: vipervenom25
2 Replies

10. UNIX for Dummies Questions & Answers

sed substitute situation

I am having a problem executing a sed substitute in a file. I have tried alot of different things I found in previous posts, however non seem to work. I want to substitute this in $FILE: VALUE=33.4 In the script I have tried the following: prev=$(awk -F"=" '{ print $2 }' $FILE ) new=$(echo... (16 Replies)
Discussion started by: newbreed1
16 Replies

Featured Tech Videos