What if the number of lines of the original file is unknown ?
In my example I gave 3 lines but it can be anything between 1 and 20 lines.
In this case you will have to have some indication for a "record" being complete. Maybe you will need some record starting criteria too, for which one could match. Provide some data and i will provide some solution.
Quote:
Originally Posted by Browser_ice
I tried the combinations below which do not change anything or are not recognized
This is just a way to enter non-printing (control-) characters into vi: enter input mode, press "CTRL-V", then press CTRL-M (for example for "^M"). You should be still in input mode and see "^M" under the cursor.
Quote:
sed 's/.$//' does remove the ^M at the end of each line but then it is still a multi-line format.
It removes the last character in a line, regardless which character this is - this is the problem. You have to specifically match "^M" (CTRL-M) and throw that out. You can throw out linefeeds by searching for "\n". Try the following with some test file:
to see the effect: two lines combined to one and the linefeed is replaced by an at.
[quote]Is there a way to find out in VI what is the ascii value of the character under the cursor ?[/qoute]
Hi,
I have a situation where I want to replace some occurrences of ".jsp" into ".html" inside a text file.
For Example:
If a pattern found like <a href="http://www.mysite.com/mypage.jsp"> it should be retained.
But if a pattern found like <a href="../mypage.jsp"> it should be changed to... (4 Replies)
Hi I'm trying to replace text in a file based upon a pattern.
The pattern I'm looking for is:
<styleURL>#style0002</styleURL>
<name>#######6105#######</name>The # are seven alphanumeric characters before and after 6105.
I need it to replace that with this recursively:
... (4 Replies)
Hi
I need to create multiple text files from onc text file on AIX. The data of text files is as below:
**********************************************
**********************************************
DBVERIFY: Release 10.2.0.4.0 - Production on Tue Nov 10 13:45:42 2009
Copyright (c) 1982,... (11 Replies)
i am editing a big log file with the following pattern:
Date: xxxx Updated: name
Some log file text here
Date: eee Updated: ny
Some log file text here
Basically i want to remove all the text in a line before the "Updated" pattern. I sill want to print the other... (4 Replies)
Can someone help me with a sed command:
There will be multiple occurences in a file that look like this:
MyFunction(12c34r5)
and I need to replace that with just the 12c34r5 for every occurrence. The text between the parentheses will be different on each occurrence, so I can't search for that.... (4 Replies)
HI Folks,
I'm looking for a solution for this issue.
I want to find the Pattern 0/ and replace it with /. I'm just removing the leading zero. I can find the Pattern but it always puts literal value as a replacement.
What am I missing??
sed -e s/0\//\//g File1 > File2
edit by... (3 Replies)
I have a sample text format as given below
<Text Text_ID="10155645315851111_10155645333076543" From="460350337461111" Created="2011-03-16T17:05:37+0000" use_count="123">This is the first text</Text>
<Text Text_ID="10155645315851111_10155645317023456" From="1626711840902323"... (3 Replies)
i have a file which contains data seperated by comma. i want to replace text after 3rd occurrence of a comma.
the input file looks like this
abcdef,11/02/2015 11:55:47,1001,1234567812345678,12364,,abc
abcdefg,11/02/2015 11:55:47,01,1234567812345678,123,,abc
abcdefhih,11/02/2015... (4 Replies)
hi unix expert
is there any command in linux to repace a pattern in the text to another pattern?
many thanks
samad (2 Replies)
Discussion started by: abdossamad2003
2 Replies
LEARN ABOUT ULTRIX
pty
pty(4) Kernel Interfaces Manual pty(4)Name
pty - pseudoterminal driver
Syntax
pseudo-device pty[n]
Description
The driver provides support for a device-pair termed a pseudoterminal. A pseudoterminal is a pair of character devices, a master device
and a slave device. The slave device provides processes with an interface identical to that described in However, whereas all other
devices that provide the interface described in have a hardware device of some sort behind them, the slave device has, instead, another
process manipulating it through the master half of the pseudoterminal. That is, anything written on the master device is given to the
slave device as input and anything written on the slave device is presented as input on the master device. The slave device can be opened
multiple times, while the master half can be opened only once.
If no optional n value is given defining the number of pseudoterminal pairs to be configured, 16 pseudoterminal pairs are configured. All
pseudoterminal lines should have a corresponding entry in the /etc/ttys file. This must be done to insure that logins that use pseudoter-
minals will be tracked in the utmp and wtmp files.
The following calls apply only to pseudoterminals:
TIOCSTOP
Stops output to a terminal (for example, like typing CTRL/S). Takes no parameter.
TIOCSTART
Restarts output (stopped by TIOCSTOP or by typing CTRL/S). Takes no parameter.
TIOCPKT
Enable/disable packet mode. Packet mode is enabled by specifying (by reference) a nonzero parameter and disabled by specifying (by
reference) a zero parameter. When applied to the master side of a pseudoterminal, each subsequent from the terminal will return
data written on the slave part of the pseudoterminal preceded by a zero byte (symbolically defined as TIOCPKT_DATA), or a single
byte reflecting control status information. In the latter case, the byte is an inclusive-or of zero or more of the bits:
TIOCPKT_FLUSHREAD
whenever the read queue for the terminal is flushed.
TIOCPKT_FLUSHWRITE
whenever the write queue for the terminal is flushed.
TIOCPKT_STOP
whenever output to the terminal is stopped by typing CTRL/S.
TIOCPKT_START
whenever output to the terminal is restarted.
TIOCPKT_DOSTOP
whenever the stop character is CTRL/S and the start character is CTRL/Q.
TIOCPKT_NOSTOP
whenever the start and stop characters are not CTRL/S and/or CTRL/Q.
This mode is used by and to implement a remote-echoed, locally flow-controlled (using CTRL/S or CTRL/Q, or both) remote login with
proper back-flushing of output. It can be used by other similar programs.
TIOCREMOTE
A mode for the master half of a pseudoterminal, independent of TIOCPKT. This mode causes input to the pseudoterminal to be flow
controlled and not input edited (regardless of the terminal mode). Each write to the control terminal produces a record boundary
for the process reading the terminal. In normal usage, a write of data is like the data typed as a line on the terminal; a write of
0 bytes is like typing an end-of-file character. TIOCREMOTE can be used when doing remote line editing in a window manager, or
whenever flow-controlled input is required.
TIOCMASTER
Allows the master to have complete control over the pseudoterminal and causes the slave side to sleep until the master relinquishes
control. This is useful in preventing changes on the pseudoterminal from going undetected and being reset by the master.
Files
(master pseudoterminals)
(slave pseudoterminals)
See Alsotty(4), MAKEDEV(8)pty(4)