05-23-2010
[Bash]Attempting to Merge text from one file into another file at the line directly under a word
Hello,
This is my first post on the forums. So I want to start by thanking anyone who is kind enough to read this post and offer advise. I hope to be an active contributor now that I've found these forums.
I have an issue that I figure would be a good first post..
I have 2 text files generated once a day.. in each is a list of successful file transfers and the 2nd file has a list of unsuccessful file transfers...
I have a 3rd file I call report.txt , in this report.txt on the first line i have " List of successful transfers:" on the 3rd line I have " List of unsuccessful transfers: " ...
I want to input the contents of file1 under the line that reads " List of successful transfers:" and I want to import the contents of file2 under the line that reads " List of unsuccessful transfers:" ... since the amount of files that succeed or fail may change daily.. I cannot just use a sed statement to insert at a specific line number.. I figure If I can find out how to insert the contents on the line directly under the line containing the word "successful" and again under the line that contains the word "unsuccessful" this would do the trick.. but not sure how to do this...
Any suggestions?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Greetings.
I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file.
I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies
2. Shell Programming and Scripting
Hi,
The file format is like the following.
timestamp=2008-02-28-23.50.29.550675;category=CONTEXT;audit event=CONNECT;
event correlator=2;
database=CURDOMS;userid=inst3;authid=INST3;
origin node=0;coordinator node=0;
application id=AC122081.FA97.054468155029;application... (2 Replies)
Discussion started by: missyou
2 Replies
3. Shell Programming and Scripting
I have a file that lists data about a system. It has a part that can look like:
the errors I'm looking for with other errors:
Alerts
Password Incorrect
Login Error
Another Error
Another Error 2
Other Info
or, just the errors I need to parse for:
Alerts
Password Incorrect
... (9 Replies)
Discussion started by: elinenbe
9 Replies
4. Shell Programming and Scripting
Hi All,
I would like help with a script which can get rid of the first work of all lines in text file.
File 1
The name is Scott.
Output : name is Scott
---------- Post updated at 02:38 PM ---------- Previous update was at 02:37 PM ----------
Hi ALL
There is typo error in... (3 Replies)
Discussion started by: bubbly
3 Replies
5. Shell Programming and Scripting
Can any one help us in finding the the last word of each line from a text file and print it.
eg:
1st --> aaa bbbb cccc dddd eeee ffff ee
2nd --> aab ered er fdf ere ww ww f
the o/p should be a below.
ee
f (1 Reply)
Discussion started by: naveen_sangam
1 Replies
6. Shell Programming and Scripting
FOLKS ,
i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one.
thanks...
Venu (3 Replies)
Discussion started by: venu
3 Replies
7. Shell Programming and Scripting
I am looking at using grep to locate the line in the text file and them use awk to select a word or words out of it.
I know awk needs -v to allow a variable to be used, but also needs -F to allow the break up of the sentence and allow the location of separate variables.
$line = grep "1:" File |... (8 Replies)
Discussion started by: Ironguru
8 Replies
8. UNIX Desktop Questions & Answers
Hi,
Im a newbie to scripting. I have a file that looks like the one below. How can i change the last "/" to become a space.
Thank You so Much for the help. :)
hostname date Feb-9 /u100/DEVCO/Patching/a.log
hostname date Jun-25 /u100/DEVCO/DumpCleaner/a.log
hostname date Jun-25... (2 Replies)
Discussion started by: lienyca
2 Replies
9. Shell Programming and Scripting
Hi All,
Hope you guys had a wonderful weekend
I have a scenario where in which I have to read a file line by line
and check for few words before redirecting to a file
I have searched the forum but,either those answers dint work (perhaps because of my wrong under standing of how IFS... (6 Replies)
Discussion started by: Kingcobra
6 Replies
10. Shell Programming and Scripting
Hi gang, I have the following code inside a the file script.sh
#!/bin/bash
todaysdate=$(date --date='7 day' +'%d')
todaysmonth=$(date +'%m')
todaysyear=$(date +'%Y')
yahoodatestring=$todaysyear$todaysmonth$todaysdate
nicedate=$(date --date='5 day' +'%A')
nice="$nicedate,... (2 Replies)
Discussion started by: phpchick
2 Replies
DR(4) Kernel Interfaces Manual DR(4)
NAME
dr - DR11-W general purpose interface driver
SYNOPSIS
/sys/conf/SYSTEM:
NDR dr11-w_units # DR11-W
/etc/dtab:
#Name Unit# Addr Vector Br Handler(s) # Comments
dr ? 172410 124 5 drintr # dr11-w (b-bus emulator)
dr ? 172430 130 5 drintr # dr11-w (gc-bus emulator)
dr ? 172450 134 5 drintr # dr11-w (em-2 interface)
major device number(s):
raw: 12
minor device encoding:
bits 0007 specify DR unit
DESCRIPTION
The Digital Equipment 1981-82 Peripherals Handbook states the following about the DR11-W:
The The DR11-W is a general purpose, direct memory access (DMA) interface to the PDP-11 UNIBUS or VAX UNIBUS. The DR11-W moves data
directly between memory and the UNIBUS to and from the user's peripheral.
It features:
o Word or byte transfers.
o Programmed or direct memory access (DMA) block transfers.
o Burst data transfers.
o User-controlled transfer rates up to memory speed.
The DR11-W is a 53-line direct memory access (DMA) interface to the PDP-11 UNIBUS or VAX UBA, which allows the user to control data
transfers between the host processor and a peripheral. The DR11-W has 32 data lines (for transferring 16-bit parallel data) and 21
control lines (for transferring control and status information.
When used as an interprocessor buffer (IPB), the DR11-W allows data transfers between two processors. Interprocessor communication
is accomplished by attaching one DR11-W to each processor UNIBUS or UBA and then cabling the two DR11-Ws together.
There. Now you know as much about it as I do.
A number of ioctl(2) calls apply to the dr devices, and have the form
#include <pdpuba/drreg.h>
ioctl(fildes, code, arg)
int *arg;
The applicable codes are:
DRGTTY Get DR11-W status.
DRSTTY Set flags and function.
DRSFUN Set function.
DRSFLAG Set flags.
DRGCSR Get CSR and WCR.
DRSSIG Set signal for ATTN interrupt.
DRESET Reset DR11-W interface.
DRSTIME Set timeout.
DRCTIME Set timeout inactive.
DROUTPUT Put word in output data register.
DRINPUT Get word from input data register.
DRITIME Don't ignore errors on timeout.
FILES
/dev/dr[0-7] device special files
/dev/MAKEDEV script to create special files
/dev/MAKEDEV.local script to localize special files
SEE ALSO
dtab(5), autoconfig(8)
DIAGNOSTICS
dr%d: error csr=%b, eir=%b
dr%d: timeout error
BUGS
This interface is only available under 2.9BSD and 2.11BSD. No documentation exists on how to use it.
3rd Berkeley Distribution January 27, 1996 DR(4)