Sponsored Content
Top Forums Shell Programming and Scripting adding characters end of line where line begins with.. Post 302477776 by cabrao on Monday 6th of December 2010 10:49:58 AM
Old 12-06-2010
Code:
ESCAPE
:
1,$s/\(^a.*,$\)/\1x


Last edited by cabrao; 12-06-2010 at 11:57 AM..
This User Gave Thanks to cabrao For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding new line at the end of file

Hi I have few files. For some files the cursor is at the end of last line. For other files, cursor is at the new line at the end. I want to bring the cursor down to next line for the files that are having cursor at the end of last line In otherwords, I want to introduce a blank line at the... (5 Replies)
Discussion started by: somesh_p
5 Replies

2. Shell Programming and Scripting

adding semicolumn at end of line

Hi , I need to add semicolumn at the end of each line in a file. can any one help me in this? Thanks in advance (2 Replies)
Discussion started by: scorpio
2 Replies

3. Shell Programming and Scripting

Get the 1st 99 characters and add new line feed at the end of the line

I have a file with varying record length in it. I need to reformat this file so that each line will have a length of 100 characters (99 characters + the line feed). AU * A01 EXPENSE 6990370000 CWF SUBC TRAVEL & MISC MY * A02 RESALE 6990788000 Y... (3 Replies)
Discussion started by: udelalv
3 Replies

4. Shell Programming and Scripting

Append text to line if begins with pattern1 AND does not end with pattern2

Hello, I'm looking for sed solution to change ... <li>keyword</li> <li>keyword <li>keyword</li> <li>keyword <li>keyword</li> ... to ... <li>keyword</li> <li>keyword</li> <li>keyword</li> <li>keyword</li> <li>keyword</li> ... I.e., if lines beginning with <li> do not end with... (3 Replies)
Discussion started by: pioavi
3 Replies

5. UNIX for Dummies Questions & Answers

Adding comma at the end of every line

Hi all, I have this sample file (actual file is larger) and i need to add comma at the end of every line. 1234 4335 232345 1212 3535 Output 1234, 4335, 232345, 1212, 3535, TIA - jak (2 Replies)
Discussion started by: jakSun8
2 Replies

6. UNIX for Dummies Questions & Answers

How to specify beginning-of-line/end-of-line characters inside a regex range

How can I specify special meaning characters like ^ or $ inside a regex range. e.g Suppose I want to search for a string that either starts with '|' character or begins with start-of-line character. I tried the following but it does not work: sed 's/\(\)/<do something here>/g' file1 ... (3 Replies)
Discussion started by: jawsnnn
3 Replies

7. Shell Programming and Scripting

Script adding ^M to end of line

I trying to make a simple script to get info from remote servers my problem is the output of this line- SERVER_NAME=`ssh -t $USER@$REMOTESERVER 'hostname'`the output is linux1^M I would like to remove the ^M where is my error? Many Thanks -Steve (1 Reply)
Discussion started by: shoodlum
1 Replies

8. Shell Programming and Scripting

Adding tab/new line at the end of each line of a file

Hello Everyone, I need a help from experts of this community regarding one of the issue that I am facing with shell scripting. My requirement is to append char's at the end of each line of a file. The char that will be appended is variable and will be passed through command line. The... (20 Replies)
Discussion started by: Sourav Das
20 Replies

9. Shell Programming and Scripting

Adding semicolon at the end of each line

Hi, I have a script which I need to change. I want to add a semicolon at the end of each line where the line starts with "grant" for e.g. create table(.... ); grant select on TABL1 to USER1 grant select on TABL1 to USER2should become create table(.... ); grant select on TABL1 to... (3 Replies)
Discussion started by: pparthiv
3 Replies

10. Shell Programming and Scripting

Adding comma to end of each line if more than 1 line

I have a file with dates as '2013-01-01' '2013-01-02' I want the output to be '2013-01-01','2013-01-02' if there is only 1 entry then there should not be any comma. (6 Replies)
Discussion started by: ATWC
6 Replies
SYSTEMD-ESCAPE(1)						  systemd-escape						 SYSTEMD-ESCAPE(1)

NAME
systemd-escape - Escape strings for usage in systemd unit names SYNOPSIS
systemd-escape [OPTIONS...] [STRING...] DESCRIPTION
systemd-escape may be used to escape strings for inclusion in systemd unit names. The command may be used to escape and to undo escaping of strings. The command takes any number of strings on the command line, and will process them individually, one after another. It will output them separated by spaces to stdout. By default, this command will escape the strings passed, unless --unescape is passed which results in the inverse operation being applied. If --mangle is given, a special mode of escaping is applied instead, which assumes the string is already escaped but will escape everything that appears obviously non-escaped. For details on the escaping and unescaping algorithms see the relevant section in systemd.unit(5). OPTIONS
The following options are understood: --suffix= Appends the specified unit type suffix to the escaped string. Takes one of the unit types supported by systemd, such as "service" or "mount". May not be used in conjunction with --template=, --unescape or --mangle. --template= Inserts the escaped strings in a unit name template. Takes a unit name template such as foobar@.service. May not be used in conjunction with --suffix=, --unescape or --mangle. --path, -p When escaping or unescaping a string, assume it refers to a file system path. This eliminates leading, trailing or duplicate "/" characters and rejects "." and ".." path components. This is particularly useful for generating strings suitable for unescaping with the "%f" specifier in unit files, see systemd.unit(5). --unescape Instead of escaping the specified strings, undo the escaping, reversing the operation. May not be used in conjunction with --suffix=, --template= or --mangle. --mangle Like --escape, but only escape characters that are obviously not escaped yet, and possibly automatically append an appropriate unit type suffix to the string. May not be used in conjunction with --suffix=, --template= or --unescape. -h, --help Print a short help text and exit. --version Print a short version string and exit. EXAMPLES
To escape a single string: $ systemd-escape 'Hallochen, Meister' Hallxc3xb6chenx2cx20Meister To undo escaping on a single string: $ systemd-escape -u 'Hallxc3xb6chenx2cx20Meister' Hallochen, Meister To generate the mount unit for a path: $ systemd-escape -p --suffix=mount "/tmp//waldi/foobar/" tmp-waldi-foobar.mount To generate instance names of three strings: $ systemd-escape --template=systemd-nspawn@.service 'My Container 1' 'containerb' 'container/III' systemd-nspawn@Myx20Containerx201.service systemd-nspawn@containerb.service systemd-nspawn@container-III.service EXIT STATUS
On success, 0 is returned, a non-zero failure code otherwise. SEE ALSO
systemd(1), systemd.unit(5), systemctl(1) systemd 237 SYSTEMD-ESCAPE(1)
All times are GMT -4. The time now is 07:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy