Sponsored Content
Top Forums Shell Programming and Scripting [Bash]Attempting to Merge text from one file into another file at the line directly under a word Post 302423851 by efciem on Saturday 22nd of May 2010 11:38:38 PM
Old 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

Can a shell script pull the first word (or nth word) off each line of a text file?

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

How to merge multiline into line begining with specific word

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

BASH: Grepping/sedding/etc out part of a file... (from one word to 'blank' line)

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

Help need to cut the first word of a line in text file

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

How to find and print the last word of each line from a text file

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

get the fifth line of a text file into a shell script and trim the line to extract a WORD

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

Grep to isolate a text file line and Awk to select a word?

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

Merge Last Word to Another File

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

Read a File line by line and split into array word by word

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

"Content-type: text/html No input file specified." Only in CRON but not when executed directly

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
UBTBCMFW(4)						   BSD Kernel Interfaces Manual 					       UBTBCMFW(4)

NAME
ubtbcmfw -- Firmware driver for Broadcom BCM2033 chip based Bluetooth USB devices SYNOPSIS
To compile this driver into the kernel, place the following line in your kernel configuration file: device ubtbcmfw Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): ubtbcmfw_load="YES" DESCRIPTION
The ubtbcmfw is a firmware driver for Broadcom BCM2033 chip based Bluetooth USB devices. It provides minimal access to the parts of the device required to download firmware. The ubtbcmfw driver creates three fixed endpoint device nodes. The control transfers can only happen on the control endpoint which is always endpoint 0. Control requests are issued by ioctl(2) calls. Only incoming transfers are supported on an interrupt endpoint. To perform I/O on an interrupt endpoint, read(2) should be used. All I/O operations on an interrupt endpoint are unbuffered. Interrupt endpoint is always endpoint 1. Only outgoing bulk transfers are supported on a bulk endpoint. To perform I/O on a bulk endpoint, write(2) should be used. All I/O opera- tions on a bulk endpoint are unbuffered. Outgoing bulk endpoint is always endpoint 2. The control endpoint (endpoint 0) handles the following ioctl(2) calls: USB_GET_DEVICE_DESC (usb_device_descriptor_t) Return the device descriptor. FILES
/dev/ubtbcmfwN.EE Endpoint EE of device N. SEE ALSO
ng_ubt(4), ugen(4), usb(4), bcmfw(8) HISTORY
The ubtbcmfw driver was implemented in FreeBSD 5.0. AUTHORS
Maksim Yevmenkin <m_evmenkin@yahoo.com> BUGS
Most likely. Please report if found. BSD
November 22, 2006 BSD
All times are GMT -4. The time now is 04:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy