Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Usage of sed, position of apostrophe Post 303022811 by Aia on Friday 7th of September 2018 01:16:17 PM
Old 09-07-2018
Quote:
Originally Posted by baris35
Hello,
I have never ever seen below notation for string substitution.

Code:
sed -i -e 's/tttt/pppp'/g /var/bin/czech.sh;

The strange thing for me is the position of the apostrophe. Should it be before the / or after the g?
If I had been writing that command line, I would have chosen below way:
Code:
sed -i -s 's/tttt/pppp/g' /var/bin/czech.sh

Could you please explain what it differs...
Is that about the operating system?

Many thanks
Boris
Regular expressions uses meta-characters. These are characters that have special meaning beyond the representation of the character. The shell has also meta-characters. Therefore in order to protect the meaning of these characters it must be quoted so it gets passed to sed as the regular expression intended.
In this case the quoting could be avoided all together sed s/tttt/pppp/g /var/bin/czech.sh since there are no meta-characters.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

translate text (1 position) with sed

Hello, I'm trying to translate a fixed length (the first 6 positions) that begins with a 0 to overwrite the field with an *. Any suggestion? File 1 ------- 013344 01:20 222343 19:30 233333 20:30 File 2 (result) ----------------- ****** 01:20 222343 19:30 233333 20:30 (5 Replies)
Discussion started by: peterk
5 Replies

2. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

3. Shell Programming and Scripting

How to replace symbols by position using SED

Hi all, I need your help. For example I have string in file.txt: -x -a /tmp/dbarchive_NSS_20081204 -f 900 -l 1 2008/12/04 2008/12/04 So, I need to replace symbols from (for e.g.) position 26 till 33 with symbols which I have in file replace.txt And I have no idea how to do it. If... (1 Reply)
Discussion started by: nypreH
1 Replies

4. Shell Programming and Scripting

Remove text from n position to n position sed/awk

I want to remove text from nth position to nth position couple of times in same line my line is "hello is there anyone can help me with this question" I need like this ello is there anyone can help me with question 'h' is removed and 'this' removed from the line. I want to do this... (5 Replies)
Discussion started by: elamurugu
5 Replies

5. Shell Programming and Scripting

Sed position specific replace

I'm drawing a blank on how to use sed to replace selectively based on position in the string (vs nth occurence): hello.|there.|how.|are.|you.| I want the period removed in the 3rd item (as defined by the pipe delimiter) if a period is present. So the result in this case would be: ... (2 Replies)
Discussion started by: tiggyboo
2 Replies

6. Shell Programming and Scripting

Replace apostrophe with backslash apostrophe

I'm coding using BASH and have a requirement to replace apostrophes with backslash apostrophes. For example below: I am here 'in my room' ok Would be changed to: I am here /'in my room/' ok The original text is coming from a field in a MySql database and is being used by another process that... (5 Replies)
Discussion started by: dbjock
5 Replies

7. Programming

How to change only one occurance of apostrophe with sed

Hi, I have a document with usual English text and some of the words have apostrophes (e.g. don't, can't, etc.) I would like all these apostrophes to be doubled (e.g. don''t, can''t, etc.), but the problem is, that some of such words have double apostrophe and by using sed -i "s/'/''/g"... (2 Replies)
Discussion started by: neptun79
2 Replies

8. Shell Programming and Scripting

Trying to move a column into another position within a sed script

Currently the table looks like this student-id,last,first,hwk1,hwk2,hwk3,exam1,hwk4,hwk5,exam2 pts-avail,,,100,150,100,200,100,150,300 991-78-7872,Thompson,Ken,95,143,79,185,95,135,259 123-45-6789,Richie,Dennis,99,123,89,189,97,139,279 234-56-7891,Aho,Al,78,146,75,176,88,128,285... (3 Replies)
Discussion started by: ertang
3 Replies

9. Shell Programming and Scripting

awk usage for position matching

i have a requirement like this if the line contains from position 294 to 299 is equal to "prabhu" ,then print entire line . i want to use awk awk '{if(substr(294-299) == 'prabhu') print "line" }' filename (1 Reply)
Discussion started by: ptappeta
1 Replies

10. UNIX for Dummies Questions & Answers

Using sed to insert at position x and then every interval y for each line

Thanks to help from Don Cragun in post 302924174, I'm off and getting into trouble on my own (finally) with sed. Here is my goal - insert \\r\n at the 60th character on each line and then every 76th character thereafter: Input:... (3 Replies)
Discussion started by: gusbrown
3 Replies
Czech(5)							File Formats Manual							  Czech(5)

NAME
Czech, czech - Introduction to Czech language support DESCRIPTION
This reference page describes the coded character set (codeset), locale, device, font, and other kinds of support for the Czech language as used in the Czech Republic. Codesets for Czech The operating system supports the following codesets for Czech by means of locales, codeset converters, or both: ISO 8859-2 (ISO Latin 2) ISO8859-2 is the string that represents this codeset in names of locales and codeset converters. See iso8859-2(5) for more informa- tion. UCS-2, UCS-4, and UTF-8 UCS-2, UCS-4, ucs4, and UTF-8 are the strings that represent these encoding formats in names of locales and codeset converters. See Unicode(5) for more information. PC code pages cp852 and cp1250 are the strings that represent PC code pages in the names of codeset converters. See code_page(5) for more informa- tion. See the i18n_intro(5) and l10n_intro(5) reference pages for introductory information on codesets. The iconv_intro(5) reference page dis- cusses codeset converters and how to use them. Locales The operating system provides the following locale for the Czech language and Czech Republic: cs_CZ.ISO8859-2 This locale is also available under the name cs_CZ.ISO8859-2@ucs4 for applications that need to convert data from ISO8859-2 file format to UCS-4 process code for character classification operations. You can use the locale command (see locale(1)) to find out if this locale is installed on your system. See i18n_intro(5) for information on setting locale. In the Common Desktop Environment (CDE), you need to set locale by setting the session language. To do this, use the Language menu accessed Options button of the Login window. Keyboards The operating system supports the following VT style and PC style keyboards with Czech characters printed on the keys: ---------------------------------------------- VT Style (105/108 keys) PC Style (102 keys) ---------------------------------------------- LK401-BV LK471-BV LK411-BV LK47W-BV LK461-BV LK97W-BV LK46W-BV PCXAL-HV PCXAL-LU PCXAL-LV PCXAL-PV PCXAL-SV ---------------------------------------------- For your keyboard to function correctly with your system, you must load a keyboard mapping table (keymap) that is appropriate for your key- board's model and language. If you load a keymap that does not correspond to your keyboard's model and language, your keyboard behavior is unpredictable. The label located on the bottom surface of a keyboard usually specifies its model (five letter code) and language (two let- ter code). See the keyboard(5) reference page for general information on keymaps and instructions for loading them in different formats. The following tables supply Czech-specific information that you need when loading keymaps. Selecting keymaps in xkb format: --------------------------------------------------------- For VT Style For PC Style Keyboard: Select: Keyboard: Select: --------------------------------------------------------- LK401-BV lk401 LK471-BV lk471bv or lk471 LK411-BV lk411 LK47W-BV lk471bv or lk471 LK461-BV lk461 LK97W-BV lk97wbv or lk97w LK46W-BV lk461 PCXAL-HV pcxalhv PCXAL-LU pcxallu PCXAL-LV pcxallv PCXAL-PV pcxalpv PCXAL-SV pcxalsv --------------------------------------------------------- Selecting keymaps in xmodmap format: ------------------------------------------------------------ For VT Style For PC Style Keyboard: Select: Keyboard: Select: ------------------------------------------------------------ LK401-BV czech lk401bv LK471-BV czech pcxalhv LK411-BV czech lk411bv LK47W-BV czech pcxalhv LK461-BV czech lk411bv PCXAL-HV czech pcxalhv LK46W-BV czech lk411bv PCXAL-LU czech pcxalhv PCXAL-LV czech pcxallv PCXAL-PV czech pcxalpv PCXAL-SV czech pcxalhv ------------------------------------------------------------ Keyboards can have keys with characters printed on both the left and right half of the keycap. The way you set or use your keyboard to send different sets of characters varies from one keyboard model to another. Furthermore, your keyboard allows you to enter more characters than those printed on the keycaps. Refer to the keyboard(5) reference page for information on how to enter characters. Printers For general information on printing support for different languages, refer to the i18n_printing(5) reference page. The PostScript fonts available for languages supported by the ISO 8859-2 codeset are listed on the iso8859-2(5) reference page. SEE ALSO
Commands: locale(1) Others: code_page(5), i18n_intro(5), i18n_printing(5), iconv_intro(5), iso8859-2(5), keyboard(5), l10n_intro(5), Unicode(5) Writing Software for the International Market Czech(5)
All times are GMT -4. The time now is 10:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy