Sponsored Content
Top Forums Shell Programming and Scripting Help need in modifying the text of .txt file Post 302215956 by FunibonE on Thursday 17th of July 2008 03:20:13 PM
Old 07-17-2008
Bug

I'm sure someone will have a better way of achieving this but here's one version:

~/scripts/play % cat file1
************************
* packageNumber : 1.0.0.14 *
* date : 2008.02.08 *
************************


~/scripts/play % cat aa
Code:
#!/bin/sh

str=1.0.0.15
timeStamp=2008.03.08
file=${HOME}/scripts/play/file1

rep1=`grep packageNumber ${file} | awk '{print $4}'`
rep2=`grep date ${file} | awk '{print $4}'`

sed -e 's/'"${rep1}"'/'"${str}"'/' -e 's/'"${rep2}"'/'"${timeStamp}"'/' $file > ${file}.tmp
mv ${file}.tmp $file

~/scripts/play % aa
~/scripts/play % cat file1
************************
* packageNumber : 1.0.0.15 *
* date : 2008.03.08 *
************************
~/scripts/play %
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: taking text from a .txt file

How would i go about the following, I open a text document with loads of text, about 150 lines e.g. "Best Time: 02:55.88" How would i get perl just to take the time and put into a variable but also be able to take any time like that from the file?? i've done this so far to open the... (2 Replies)
Discussion started by: perleo
2 Replies

2. Shell Programming and Scripting

Script for removing text from a txt file

Hello, So I wanted to write a very simple script to remove some information from a text file and save it as something else. For example I have a text file (let's call it txt) with three rows of numbers: 0 0 1 9 8 7 5 0 6 7 9 0 0 7 9 8 1 1 6 4 0 6 0 0 9 8 4 6 0 9 2 8 1 And I want to... (2 Replies)
Discussion started by: hertingm
2 Replies

3. Shell Programming and Scripting

Inserting text and modifying the file

I am in a dire need of doing this job , please help from shell script or perl script. It will be highly appreciated. Please have a look at the following INPUT file; The first 14 rows are not of interest but I want them to be included in the output file as they are. From the row 14... (3 Replies)
Discussion started by: digipak
3 Replies

4. Shell Programming and Scripting

Help needed in extracting text present between two headers in .txt file

Hi All, Please help me out in fllowing problem. I have text file which contains the data in following format. Contents of file.txt are setregid02 Test that setregid() fails and sets the proper errno values when a non-root user attemps to change the real or effective... (2 Replies)
Discussion started by: varshit
2 Replies

5. Solaris

Copy and paste text from a word document into a txt file in vi

Hello, Can anybody please tell me how we can copy and paste text from a word document into a text file that we are editing in vi? Is it possible to do that while we are editing the text file in vi in insert mode? Thanks, (3 Replies)
Discussion started by: Pouchie1
3 Replies

6. Shell Programming and Scripting

Small query on modifying the text of file

Hi, I have file with the following text, /analysis2012/533/mc_S10_533/DYJets50/vgtree_1_1_33l.root /analysis2012/533/mc_S10_533/DYJets50/vgtree_2_5_33l.root /analysis2012/533/mc_S10_533/DYJets50/vgtree_6_7_33l.root and many such files. For some operation on these files, I would like... (9 Replies)
Discussion started by: emily
9 Replies

7. Windows & DOS: Issues & Discussions

2 Questions: replace text in txt file, add text to end of txt file

so... Lets assume I have a text file. The text file contains multiple "#" symbols. I want to replace all thos "#"s with a STRING using DOS/Batch I want to add a certain TEXT to the end of each line. How can I do this WITHOUT aid of sed, grep or anything linux related ? (1 Reply)
Discussion started by: pasc
1 Replies

8. Shell Programming and Scripting

Script extract text from txt file with grep

All, I require a script that grabs some text from the gitHub API and will grep (or other function) for a string a characters that starts with (") quotes followed by two letters, may contain a pipe |, and ending with ) . What i have so far is below but it's not returning anything. ... (4 Replies)
Discussion started by: ChocoTaco
4 Replies

9. Shell Programming and Scripting

Removing duplicate sequences and modifying a text file

Hi. I've tried several different programs to try and solve this problem, but none of them seem to have done exactly what I want (and I need the file in a very specific format). I have a large file of DNA sequences in a multifasta file like this, with around 15 000 genes: ... (2 Replies)
Discussion started by: 4galaxy7
2 Replies

10. Shell Programming and Scripting

Modifying text file records, find data in one place in the record and print it elsewhere

Hello, I have some text data that is in the form of multi-line records. Each record ends with the string $$$$ and the next record starts on the next line. RDKit 2D 15 14 0 0 0 0 0 0 0 0999 V2000 5.4596 2.1267 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 ... (5 Replies)
Discussion started by: LMHmedchem
5 Replies
PLAIT(1)							   User Commands							  PLAIT(1)

NAME
Plait - Command-line Jukebox. DESCRIPTION
Usage is: "plait <hint about artist or album or song> [[not] <hint>]...[as <mix>]", or "plait --stream <hint> [[not] <hint>]..." OPTIONS
--list,-l -- show matching tracks but don't play --mix,-m -- play tracks matching any hint (make a mix) --queue,-q -- add tracks to queue --random,-r -- play in random order --sort -- play in sorted order --stripe -- play in alternating order --stripe2 -- play in random alternating order --fade -- play in gaussian fade order --group -- play randomly in groups --tracks,-t -- play n tracks, if possible --stream,-s -- play Shoutcast radio streams --mixfile,-f -- read hints from mixfile --device,-d -- choose target device --platform -- choose platform --coverart -- cover art mode (0 or 1) --guest,-g -- use guest configuration --interactive,-i -- interactive mode --cache,-c -- rebuild cache --install -- install Plait --uninstall -- uninstall Plait --play --pause --stop --next --prev --help -- show help --version -- show version AUTHOR
Written by Stephen Jungels (http://stephenjungels.com/contact) COPYRIGHT
Copyright (C) 2005-2008 by Stephen Jungels. Released under the GPL. Latest version and more info at http://plait.sourceforge.net/ Plait v 1.6.2 September 2008 PLAIT(1)
All times are GMT -4. The time now is 09:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy