🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: demon.tech.unix
6 messages
6 total messages Started by David Sat, 08 Apr 2000 00:00
help
#373
Author: David
Date: Sat, 08 Apr 2000 00:00
10 lines
820 bytes
Hey everyone,

I'm writing a script file and need to know how to remove a specific line of
text from a .txt file.

I can use        grep $variable filename        to get it but how can I
remove that line?

Thanks
David..
Re: help
#372
Author: Richard Howlett
Date: Fri, 07 Apr 2000 00:00
18 lines
1084 bytes
David wrote:
> 
> Hey everyone,
> 
> I'm writing a script file and need to know how to remove a specific line of
> text from a .txt file.
> 
> I can use        grep $variable filename        to get it but how can I
> remove that line?

grep -v $variable filename >newfilename

will remove the line and put the remaining lines in newfilename

-- 
Richard Howlett

mailto:richard@howie.org.uk
Re: help
#374
Author: Phil Reynolds
Date: Sat, 08 Apr 2000 00:00
19 lines
1172 bytes
In article <K8sH4.767$5D.1658@ozemail.com.au>,
	"David" <dschmidt1@ozemail.com.au> writes:
> Hey everyone,
> 
> I'm writing a script file and need to know how to remove a specific line of
> text from a .txt file.
> 
> I can use        grep $variable filename        to get it but how can I
> remove that line?

One way would be to do this:

grep -v $variable filename > newfile

-- 
Phil Reynolds
 o  ____ Internet: philr@hedgford.demon.co.uk
|L_ \  / Web: http://www.hedgford.demon.co.uk/phil/
(_)- \/  Waltham 67, Emley Moor 69, Droitwich 79, Windows 95
Re: help
#375
Author: Stuart Tomlinson
Date: Fri, 14 Apr 2000 00:00
55 lines
1938 bytes
Ob the subject of shell scripts, I need to write 2 values (user input and
time) to a file

Got this working but I need them on the same line

at mo echo ing result >> file
and then time >> file

but results look like
1
11,34
2
11.35


Anyone know how result can be so i have entries like
1    11.34
2     11.35


Sorry if this isnt the type of post this newsgroup is for!!


Rgds


Stu

--
Stu. Techy Bod.  ICQ 55421702 stu@ttscomputers.co.uk
Jap MCC Broxburn. Z440 running!!!! Suzi gt250-rebuild  KawaZ1000G -missing
"Friends Help you move, Real Friends help you move bodies."
"I miss my ex-wife, BUT my aim is improving"
Phil Reynolds <philr@hedgford.demon.co.uk> wrote in message
news:n52nc8.i7s.ln@127.0.0.1...
> In article <K8sH4.767$5D.1658@ozemail.com.au>,
> "David" <dschmidt1@ozemail.com.au> writes:
> > Hey everyone,
> >
> > I'm writing a script file and need to know how to remove a specific line
of
> > text from a .txt file.
> >
> > I can use        grep $variable filename        to get it but how can I
> > remove that line?
>
> One way would be to do this:
>
> grep -v $variable filename > newfile
>
> --
> Phil Reynolds
>  o  ____ Internet: philr@hedgford.demon.co.uk
> |L_ \  / Web: http://www.hedgford.demon.co.uk/phil/
> (_)- \/  Waltham 67, Emley Moor 69, Droitwich 79, Windows 95
Re: help
#376
Author: 'Dungeon' Dave
Date: Fri, 14 Apr 2000 00:00
31 lines
1454 bytes
.. and it came to pass that Stuart Tomlinson
<stu@ttscomputers.co.uk> uttered forth:
>Ob the subject of shell scripts, I need to write 2 values (user input and
>time) to a file
>
>Got this working but I need them on the same line
>
>at mo echo ing result >> file
>and then time >> file

Try echoing a "continuation" character (\c) after the first echo, ie:

echo "This is a line of text at \c" >>file
date +%H:%M >>file

should give you :

This is a line of text at Sunday, 12th october

Alternatively, try embedding the actual time into the line itself, eg:

echo "This is a line of text at `date +%H:%M`" >>file

HTH!!
-- 
 
"Dungeon" Dave, in anti-harvest mode...

From: abuse@yahoo.com
From: abuse@btinternet.com
From: *@localhost
Re: help
#377
Author: Richard Howlett
Date: Fri, 14 Apr 2000 00:00
30 lines
1443 bytes
Stuart Tomlinson wrote:
> 
> Ob the subject of shell scripts, I need to write 2 values (user input and
> time) to a file
> 
> Got this working but I need them on the same line
> 
> at mo echo ing result >> file
> and then time >> file

man echo

Depending on your shell either:

1. -n between the echo and the argument to echo. Eg.
    echo -n "some words\t"
    echo "some more words"
The \t echos a tab character. You could substitute it for a space. The
double quotes are necessary.

2. \c as the last character of the line. Eg.
    echo "some words\t\c"
    echo "some more words"

My shell (Korn on SCO OpenServer) supports both but YMMV.

-- 
Richard Howlett

mailto:richard@howie.org.uk
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads