If you tell more, maybe error output and maybe a snippet of your input file as example, it might be easier to help.
Did shell variable substitution inside sed not work or the whole construct?
Can't see if you fille $date with the output of the date command. Maybe you do this or just add a
instead of just putting in a $date.
Dear all,
I would like to combine all lines of a file with all lines of another file:
The input are
file 1
A
B
C
D
file 2
A
B
C
D
The output is
final file
A_A
A_B
A_C (3 Replies)
Hi,
I have an issue to combine multiple lines of a file. I have records as below.
Fields are delimited by TAB. Each lines are ending with a new line char (\n)
Input
--------
ABC 123456 abcde 987
890456 7890 xyz
ght gtuv
ABC 5tyin 1234 789
ghty kuio
ABC ghty jind 1234
678 ght
... (8 Replies)
Hello,
Input file looks like this:
apples
bananas
oranges and rice
pears
cherries
mango
I want output to look like this:
apples bananas
oranges and rice pears
cherries mango
It should combine line 1 with line 2 and line 3 with line 4 like that....
Right now, only way I can... (4 Replies)
I can't decide if I should use AWK or PERL after pouring over these forums for hours today I decided I'd post something and see if I couldn't get some advice.
I've got a text file full of hundreds of events in this format:
Record Number : 1
Records in Seq : ... (3 Replies)
Hi All,
I am trying to understand if its possible to carry out the following.
I have a text file which contains output from multiple commands, within the file a node will be quiered twice if there was 2 commands for example. Is it possible do combine 2 lines into 1 if the first word is the... (1 Reply)
Hi,
I have a requirement where I need to combine two lines in a file based on first character of each line in a file.
Please find the sample content of the file below:
Code:
_______________________
5, jaya, male, 4-5-90, single
smart
6, prakash, male, 5-4-84, married
fair
7, raghavi,... (1 Reply)
Hi,
I have a requirement where I need to combine two lines in a file based on first character of each line in a file.
Please find the sample content of the file below:
Code:
_______________________
5, jaya, male, 4-5-90, single
smart
6, prakash, male, 5-4-84, married
fair
7, raghavi,... (1 Reply)
Hi,
I have a requirement where I need to combine two lines in a file based on first character of each line in a file.
Please find the sample content of the file below:
_______________________
5, jaya, male, 4-5-90, single
smart
6, prakash, male, 5-4-84, married
fair
7, raghavi, female,... (12 Replies)
I am trying to combine all matching lines in the tab-delimited using awk. The below runs but no output results. Thank you :).
input
chrX 110925349 110925532 ALG13
chrX 110925349 110925532 ALG13
chrX 110925349 110925532 ALG13
chrX 47433390 47433999 SYN1... (3 Replies)
Greetings,
I have large file with following format
name1 name2
name3 name4
name5 name6
child7 child8 child9 <== there is leading blank space
child10 child11 child12 <== there is leading blank space
name13 name14
name15 name16
child17 child18... (6 Replies)
Discussion started by: rnnyusa
6 Replies
LEARN ABOUT DEBIAN
edinplace
edinplace(1) Mail Avenger 0.8.3 edinplace(1)NAME
edinplace - edit a file in place
SYNOPSIS
edinplace [--error=code] [[--file=file] command [arg ...]]
DESCRIPTION
edinplace runs command with its input from file (or standard input by default), and then replaces the contents of file with the output of
command. To the extent possible, edinplace attempts to exit with the same status as command.
If edinplace is run on standard input (no --file option), it must inherit a file descriptor 0 that is open for both reading and writing.
When processing standard input, if edinplace does not encounter a fatal error, it rewinds its standard input to offset 0 before exiting.
Thus, a script can first run edinplace command, then run another filter command such as grep, and the resulting output will be the output
of grep on command's output.
If no command is specified, edinplace just rewinds its standard input to file offset 0. In this case, it is an error to supply the --file
option. Of course, rewinding only works when standard input is a real file (as opposed to a pipe or device).
There are two options:
--error=code (-x code)
Ordinarily, edinplace attempts to exit with the same status as command. However, if edinplace encounters some fatal error (such as
being unable to execute command), it will exit with status code. The default value is 1. The range of valid exit codes is 1-255,
inclusive.
--file=file (-f file)
Specifies that file should be edited. Otherwise, edinplace will edit its standard input (which must be opened for both reading and
writing).
--skipfrom
Skip the first line of the file if it starts "From ". If edinplace is run without a command, positions the file offset at the start of
the second line of the file. If edinplace is run with a command, then the first line of the file is neither fed to the command, nor
overwritten. This option is useful for running edinplace over mail files, which sometimes start with a "From " line specifying the
envelope sender of the message. Since "From " is not part of the message header, just a Unix convention, some programs are confused by
the presence of that line. Note that if you specify a command, then edinplace resets the file offset to 0 upon exiting, even if the
--skipfrom option was present.
EXAMPLES
The following command prepends the string "ORIGINAL: " to the beginning of each line in text file message:
edinplace -f message sed -e 's/^/ORIGINAL: /'
The following command runs the spamassassin mail filter program on a mail message stored in file message, replacing the contents of message
with spamassassin's annotated output, and exiting with code 100 if spamassassin thinks the message is spam. If edinplace encounters any
fatal errors, it will exit with code 111.
edinplace -x 111 -f message spamassassin -e 100
(spamassassin reads a mail message on standard input and outputs an annotated copy of the message including information about whether or
not the message is likely to be spam and why. The -e option to spamassassin specifies what exit status spamassassin should use if the
message appears to be spam; edinplace will use the same exit code as the program it has run.)
To run spamassassin on incoming mail before accepting the mail from the remote client, place the following line in an appropriate Mail
Avenger rcpt file as the last command executed:
bodytest edinplace -x 111 spamassassin -e 100
SEE ALSO avenger(1)
The Mail Avenger home page: <http://www.mailavenger.org/>.
BUGS
edinplace does not make a copy of the file being edited, but rather overwrites the file as it is being processed. At any point where
command has produced more output than it has consumed input from the file, edinplace buffers the difference in memory. Thus, a command
that outputs large amounts of data before reading the input file can run edinplace out of memory. (A program that outputs data as it reads
even a very large file should be fine, however.)
If command crashes or malfunctions for any reason, you will likely lose the input file, since edinplace will view this as a program that
simply outputs the empty file.
AUTHOR
David Mazieres
Mail Avenger 0.8.3 2012-04-05 edinplace(1)