Hello. Trying to insert text at line 1 and after last line of file. I have searched posts but nothing seems to work. I keep getting extra characters error or nothing gets inserted into the file.
#!/bin/sh
touch textfile.txt
sed 'i\
Add this line before every line with WORD' textfile.txt
... (5 Replies)
Hello all
i have big test file that has allot of structure text something like this :
<foo1 *.html>
<blah action>
somthing 1
somthing 2
</blah>
</foo1 >
now i will like to insert 2 more lines of text below the <blah action>
so it will be like :
<foo1... (1 Reply)
My txt file consists of records with 6 numbers followed by 3 characters.
Is there a simple “sed” which will insert a | separator between the 6th and 7th position ?
Many thanks (3 Replies)
I have done this sed command to insert one line after a specific string is found:
sed '/patternstring/ a\
new line string' file1
But how do I insert two lines? This is not possible:
sed '/patternstring/ a\
new line string \a
new line string 2' file1 (2 Replies)
hi I am trying to use SED to replace the line matching a pattern using the command
sed 'pattern c\
new line
' <file1 >file 2
I got two questions
1. how do I insert a blank space at the beginning of new line?
2. how do I use this command to execute multiple command using the -e... (5 Replies)
Hi,
I have a xml file (Config.xml) with following entry
<Date="" Node1="50" Groups="20">
Now I want to use sed to insert/update the Date field with the latest date say - 20120711. I can't use a simple replace command becuase the Date field could be blank ("") or sometimes could have value in... (9 Replies)
Hi all,
I have a file like this
Q8N302
21-84
Q8N157
15-45
Q99996
167-201
202-251
269-318
I want to insert a character or space if the line starts with a number and I used the command
sed 's/^/#/'
But in the output file, when it inserts this character, first digit in the number is... (2 Replies)
Hi I was wondering if anyone new of a solution to this problem? I need to copy a time stamp that is on a line of .text in a text file into multiple positions on the same line.
I need to insert the time stamp on the same line between every occurance of the text ".pdf_.html" right after the... (9 Replies)
HI All
Im trying to come up with an approach to finding a string, using a portion of that string to insert it on lines starting with the value "GOTO" appending to end of line after removing PT's ( See example below! )
EXAMPLE:
1. I would like to search for the line that starts with "TLAXIS/"... (7 Replies)
Discussion started by: graymj
7 Replies
LEARN ABOUT PLAN9
rune
RUNE(2) System Calls Manual RUNE(2)NAME
runetochar, chartorune, runelen, fullrune, utflen, utfrune, utfrrune, utfutf - rune/UTF conversion
SYNOPSIS
#include <u.h>
#include <libc.h>
int runetochar(char *s, Rune *r)
int chartorune(Rune *r, char *s)
int runelen(long r)
int fullrune(char *s, int n)
int utflen(char *s)
char* utfrune(char *s, long c)
char* utfrrune(char *s, long c)
char* utfutf(char *s1, char *s2)
DESCRIPTION
These routines convert to and from a UTF byte stream and runes.
Runetochar copies one rune at r to at most UTFmax bytes starting at s and returns the number of bytes copied. UTFmax, defined as 3 in
<libc.h>, is the maximum number of bytes required to represent a rune.
Chartorune copies at most UTFmax bytes starting at s to one rune at r and returns the number of bytes copied. If the input is not exactly
in UTF format, chartorune will convert to 0x80 and return 1.
Runelen returns the number of bytes required to convert r into UTF.
Fullrune returns 1 if the string s of length n is long enough to be decoded by chartorune and 0 otherwise. This does not guarantee that
the string contains a legal UTF encoding. This routine is used by programs that obtain input a byte at a time and need to know when a full
rune has arrived.
The following routines are analogous to the corresponding string routines with utf substituted for str and rune substituted for chr.
Utflen returns the number of runes that are represented by the UTF string s.
Utfrune (utfrrune) returns a pointer to the first (last) occurrence of rune c in the UTF string s, or 0 if c does not occur in the string.
The NUL byte terminating a string is considered to be part of the string s.
Utfutf returns a pointer to the first occurrence of the UTF string s2 as a UTF substring of s1, or 0 if there is none. If s2 is the null
string, utfutf returns s1.
SOURCE
/sys/src/libc/port/rune.c
/sys/src/libc/port/utfrune.c
SEE ALSO utf(6), tcs(1)RUNE(2)