Sponsored Content
Top Forums Shell Programming and Scripting SED- Insert text at top of file Post 23673 by MBGPS on Thursday 27th of June 2002 05:03:33 AM
Old 06-27-2002
Ouch,

I get the error:
sed: command garbled: 1iEXEC PR_DbConfigStart 'test.txt', '10', 'DESCRIPTION'

when I try this.

Here is the script im using

#!/usr/bin/ksh
FILENAME=test2.txt
TMP=.$TMP
TMPFILENAME=$FILENAME$TMP
sed -e "1i\
EXEC PR_DbConfigStart 'some text', '10', 'DESCRIPTION' " < $FILENAME >$TMPFILENAME
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

insert text into top of file

how would you insert text into a existing file using aguments first arguments being the line of text and the second argument being file name (1 Reply)
Discussion started by: jimbob
1 Replies

2. UNIX for Dummies Questions & Answers

how do I insert argument into TOP of file using vi?

when directing some text into a file can you choose where it goes like the top of the file (which is text aswell) or the middle?? if so how - especially would like to know how to do so in vi (text editor) If i were to enter an argument ($1) into a another argument ($2) would it would be... (6 Replies)
Discussion started by: rprules
6 Replies

3. Shell Programming and Scripting

Need to insert new text and change existing text in a file using SED

Hi all, I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output. sed '$a\ hi... ' shell > shell1 But I face problem when using the same in script. It is throwing the error as, sed: command garbled:... (4 Replies)
Discussion started by: iamgeethuj
4 Replies

4. Shell Programming and Scripting

best way to insert a line at the top of a file?

say I want to insert "this is a test" as the first line into file A, besides echo "this is a test" > /tmp/tmpfile cat /tmp/tmpfile fileA >> /tmp/result, is there any simple way I can do it? thanks (7 Replies)
Discussion started by: fedora
7 Replies

5. Shell Programming and Scripting

Insert text file only after the first match with SED

Hello, I'm new in Shell scripting but i should write a script, which inserts the license header out of a txt-File into the files in our Projekt. For the Java classes it runs without Problems but for XML files not. At xml-files i have to put the license Header after the xml-Header (?xml... (1 Reply)
Discussion started by: PhoenixONE
1 Replies

6. Shell Programming and Scripting

Sed insert text at first line of empty file

I can't seem to get sed to allow me to insert text in the first line of an empty file. I have a file.txt that is a 0 byte file. I want sed to insert " fooBar" onto the first line. I've tried a few options and nothing seems to work. They work just fine if there's text in the file tho. Help? (4 Replies)
Discussion started by: DC Slick
4 Replies

7. Shell Programming and Scripting

Using sed to insert text file at first line

sed '1r file.txt' <source.txt >desti.txt This example will insert 'file.txt' between line 1 and 2 of source.txt. sed '0r file.txt' <source.txt >desti.txt gives an error message. Does anyone know how 'sed' can insert 'file.txt' before the first line of source.txt? (18 Replies)
Discussion started by: psve
18 Replies

8. UNIX for Advanced & Expert Users

Insert string in binary file at top

How can i append a EBCDIC string of 100 bytes to 0th position of a binary file in UNIX. (4 Replies)
Discussion started by: param_it
4 Replies

9. Shell Programming and Scripting

How do I insert text with sed ?

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)
Discussion started by: Paul Walker
9 Replies

10. Shell Programming and Scripting

Insert date/time header at top of file

I'm trying to take mrt output and put it at the top of a file along with the date and time. I was able to do it at the bottom of the file with the following printf "********** $(date) **********\n\n" >> $OUTPUT_PATH/$HOSTNAME mtr -r -w -c 10 $HOSTADDRESS >> $OUTPUT_PATH/$HOSTNAME printf... (2 Replies)
Discussion started by: kramer65
2 Replies
QwtPlainTextEngine(3)						 Qwt User's Guide					     QwtPlainTextEngine(3)

NAME
QwtPlainTextEngine - A text engine for plain texts. SYNOPSIS
#include <qwt_text_engine.h> Inherits QwtTextEngine. Public Member Functions virtual void draw (QPainter *painter, const QRect &rect, int flags, const QString &text) const virtual int heightForWidth (const QFont &font, int flags, const QString &text, int width) const virtual bool mightRender (const QString &) const QwtPlainTextEngine () virtual void textMargins (const QFont &, const QString &, int &left, int &right, int &top, int &bottom) const virtual QSize textSize (const QFont &font, int flags, const QString &text) const virtual ~QwtPlainTextEngine () Detailed Description A text engine for plain texts. QwtPlainTextEngine renders texts using the basic Qt classes QPainter and QFontMetrics. Constructor &; Destructor Documentation QwtPlainTextEngine::QwtPlainTextEngine () Constructor. QwtPlainTextEngine::~QwtPlainTextEngine () [virtual] Destructor. Member Function Documentation void QwtPlainTextEngine::draw (QPainter *painter, const QRect &rect, intflags, const QString &text) const [virtual] Draw the text in a clipping rectangle. A wrapper for QPainter::drawText. Parameters: painter Painter rect Clipping rectangle flags Bitwise OR of the flags used like in QPainter::drawText text Text to be rendered Implements QwtTextEngine. int QwtPlainTextEngine::heightForWidth (const QFont &font, intflags, const QString &text, intwidth) const [virtual] Find the height for a given width Parameters: font Font of the text flags Bitwise OR of the flags used like in QPainter::drawText text Text to be rendered width Width Returns: Calculated height Implements QwtTextEngine. bool QwtPlainTextEngine::mightRender (const QString &) const [virtual] Test if a string can be rendered by this text engine. Returns: Always true. All texts can be rendered by QwtPlainTextEngine Implements QwtTextEngine. void QwtPlainTextEngine::textMargins (const QFont &font, const QString &, int &left, int &right, int &top, int &bottom) const [virtual] Return margins around the texts Parameters: font Font of the text left Return 0 right Return 0 top Return value for the top margin bottom Return value for the bottom margin Implements QwtTextEngine. QSize QwtPlainTextEngine::textSize (const QFont &font, intflags, const QString &text) const [virtual] Returns the size, that is needed to render text Parameters: font Font of the text flags Bitwise OR of the flags used like in QPainter::drawText text Text to be rendered Returns: Caluclated size Implements QwtTextEngine. Author Generated automatically by Doxygen for Qwt User's Guide from the source code. Version 5.2.2 Mon Aug 1 2011 QwtPlainTextEngine(3)
All times are GMT -4. The time now is 01:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy