Sponsored Content
Full Discussion: sed prepend text ?
Top Forums Shell Programming and Scripting sed prepend text ? Post 302696853 by upengan78 on Wednesday 5th of September 2012 02:20:38 PM
Old 09-05-2012
sed prepend text ?

Hi,

I have a file with email header information. I would like to change the Subject line.

Code:
Subject: ** PROBLEM Host Alert: server.domainname is DOWN **

I'd like to change this line such as to look,
Code:
Subject: serverID ACK Fw: ** PROBLEM Host Alert: server1.domainname is DOWN**

How can I edit this? sed or anything else is fine.

Note: server1.domainname, is not always constant it could be server2, server3.domainname up until server30.domainname
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

prepend columns to a file

I have two files. File 'a' has contents: 1|1 2|2 3|3 4|4 and file 'b' has contents: abc|def hij|klm nop|qrs tuv|wxy I would like to prepend file 'a' to file 'b' (with pipe) such that the contents of 'b' will be: 1|1|abc|def 2|2|hij|klm 3|3|nop|qrs 4|4|tuv|wxy (3 Replies)
Discussion started by: ChicagoBlues
3 Replies

2. Shell Programming and Scripting

Need to insert new text and change existing text in a file using SED

Hi all, I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output. sed '$a\ hi... ' shell > shell1 But I face problem when using the same in script. It is throwing the error as, sed: command garbled:... (4 Replies)
Discussion started by: iamgeethuj
4 Replies

3. Shell Programming and Scripting

Append and Prepend Text to a file list

I want to print out a directory listing, then append ] to the end of each line. I'm trying to create a list of Wiki links based on folder listings that i can just copy and paste without having to edit 100's of file listings. Using sed i've figured out to do something like this: sed... (4 Replies)
Discussion started by: CapnDoody
4 Replies

4. Shell Programming and Scripting

Help with uniq -D [prepend]

Hi, I am trying to add a blank line between sets of replicate values. I have been trying to use uniq -D -f4 input.txt > output.txt The input is like V2-1.0 -1.0 5500.00 4162.00 529976.06030125.0 1997A V2-1.0 -1.0 6000.00 4285.00 ... (6 Replies)
Discussion started by: eknryan
6 Replies

5. Shell Programming and Scripting

awk text record - prepend first field to all subsequent fields

Hello everyone, I've suddenly gotten very interested in sed and awk (and enjoying it quite a bit too) because of a large conversion project that we're working on. I'm currently stuck with a very inefficient process for processing text blocks. I'm sure someone here should be able to easily point out... (2 Replies)
Discussion started by: jameswatson3
2 Replies

6. Shell Programming and Scripting

How to prepend spaces using sed command..?

hi all , i had the below sed command to append header at the starting of my output file .... sed -i -e '1i saikumar suresh hemanth' output.txt i want to append spaces to the Name saikumar how can i append with in this command ....? (1 Reply)
Discussion started by: hemanthsaikumar
1 Replies

7. Shell Programming and Scripting

Prepend text, different matched 1st letters

Prepending lines with: your, the, a or an based on 1st letter match. You'll see my problem below: sed '/^p\|^f\|^c\|^d\|^l/ s/^/your /' list.txt > your.txt && sed '/^v\|^j\|^k\|^m\|^n\|^s/ s/^/the /' your.txt > the.txt && sed '/^b\|^g\|^h\|^q\|^r\|^t\|^w\|^z/ s/^/a /' the.txt > a.txt && sed... (10 Replies)
Discussion started by: p1ne
10 Replies

8. Shell Programming and Scripting

Gnu tool; sed awk echo etc to prepend or append string to a file

Looking to add text to a file, example File example; nodegroups: check-hosts: L@host.domain.com,host2.domain.com,host3.domain.com I need to take a file with a one line list of hosts separated by commas host.domain.com,host2.domain.com,host3.domain.comand prepend the string " ... (6 Replies)
Discussion started by: bash_in_my_head
6 Replies

9. UNIX for Beginners Questions & Answers

Prepend 0 to a field in a record

Hi All, I have a file like below. In the field 9 I am having 14,014,3,001/009 on the records. I want to convert the field to a three digit value. For example 14 should 014 , 3 should 003 11050;11001;;CREDITTRANC;5293218;NRATL;;;11095;;-1;14;3;29=0000;1.25... (5 Replies)
Discussion started by: arunkumar_mca
5 Replies

10. Shell Programming and Scripting

Find header in a text file and prepend it to all lines until another header is found

I've been struggling with this one for quite a while and cannot seem to find a solution for this find/replace scenario. Perhaps I'm getting rusty. I have a file that contains a number of metrics (exactly 3 fields per line) from a few appliances that are collected in parallel. To identify the... (3 Replies)
Discussion started by: verdepollo
3 Replies
ICONV_MIME_ENCODE(3)							 1						      ICONV_MIME_ENCODE(3)

iconv_mime_encode - Composes a MIMEheader field

SYNOPSIS
string iconv_mime_encode NULL (string $field_name, string $field_value, [array $preferences]) DESCRIPTION
Composes and returns a string that represents a valid MIME header field, which looks like the following: Subject: =?ISO-8859-1?Q?Pr=FCfung_f=FCr?= Entwerfen von einer MIME kopfzeile PARAMETERS
o $field_name - The field name. o $field_value - The field value. o $preferences - You can control the behaviour of iconv_mime_encode(3) by specifying an associative array that contains configuration items to the optional third parameter $preferences. The items supported by iconv_mime_encode(3) are listed below. Note that item names are treated case-sensitive. Configuration items supported by iconv_mime_encode(3) +-----------------+--------------------------+---+---+---+ | Item | | | | | | | | | | | | | Type | | | | | | | | | | | | Description | | | | | | | | | | | | Default value | | | | | | | | | | | | Example | | | | | | | | | | +-----------------+--------------------------+---+---+---+ | scheme | | | | | | | | | | | | | | | | | | | string | | | | | | | | | | | | Specifies the method to | | | | | | encode a field value by. | | | | | | The value of this item | | | | | | may be either "B" or | | | | | | "Q", where "B" stands | | | | | | for base64 encoding | | | | | | scheme and "Q" stands | | | | | | for quoted-printable | | | | | | encoding scheme. | | | | | | | | | | | | B | | | | | | | | | | | | B | | | | | | | | | | | input-charset | | | | | | | | | | | | | | | | | | | string | | | | | | | | | | | | Specifies the character | | | | | | set in which the first | | | | | | parameter $field_name | | | | | | and the second parameter | | | | | | $field_value are pre- | | | | | | sented. If not given, | | | | | | iconv_mime_encode(3) | | | | | | assumes those parameters | | | | | | are presented to it in | | | | | | the iconv.inter- | | | | | | nal_encoding ini set- | | | | | | ting. | | | | | | | | | | | | iconv.internal_encoding | | | | | | | | | | | | ISO-8859-1 | | | | | | | | | | | output-charset | | | | | | | | | | | | | | | | | | | string | | | | | | | | | | | | Specifies the character | | | | | | set to use to compose | | | | | | the MIME header. | | | | | | | | | | | | iconv.internal_encoding | | | | | | | | | | | | UTF-8 | | | | | | | | | | | line-length | | | | | | | | | | | | | | | | | | | integer | | | | | | | | | | | | Specifies the maximum | | | | | | length of the header | | | | | | lines. The resulting | | | | | | header is "folded" to a | | | | | | set of multiple lines in | | | | | | case the resulting | | | | | | header field would be | | | | | | longer than the value of | | | | | | this parameter, accord- | | | | | | ing to RFC2822 - Inter- | | | | | | net Message Format. If | | | | | | not given, the length | | | | | | will be limited to 76 | | | | | | characters. | | | | | | | | | | | | 76 | | | | | | | | | | | | 996 | | | | | | | | | | |line-break-chars | | | | | | | | | | | | | | | | | | | string | | | | | | | | | | | | Specifies the sequence | | | | | | of characters to append | | | | | | to each line as an end- | | | | | | of-line sign when "fold- | | | | | | ing" is performed on a | | | | | | long header field. If | | | | | | not given, this defaults | | | | | | to " " ( CR LF). Note | | | | | | that this parameter is | | | | | | always treated as an | | | | | | ASCII string regardless | | | | | | of the value of input- | | | | | | charset. | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +-----------------+--------------------------+---+---+---+ RETURN VALUES
Returns an encoded MIME field on success, or FALSE if an error occurs during the encoding. EXAMPLES
Example #1 iconv_mime_encode(3) example <?php $preferences = array( "input-charset" => "ISO-8859-1", "output-charset" => "UTF-8", "line-length" => 76, "line-break-chars" => " " ); $preferences["scheme"] = "Q"; // This yields "Subject: =?UTF-8?Q?Pr=C3=BCfung=20Pr=C3=BCfung?=" echo iconv_mime_encode("Subject", "Prufung Prufung", $preferences); $preferences["scheme"] = "B"; // This yields "Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=" echo iconv_mime_encode("Subject", "Prufung Prufung", $preferences); ?> SEE ALSO
imap_binary(3), mb_encode_mimeheader(3), imap_8bit(3), quoted_printable_encode(3). PHP Documentation Group ICONV_MIME_ENCODE(3)
All times are GMT -4. The time now is 11:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy