Sponsored Content
Top Forums Shell Programming and Scripting Removing last occurance of string in text Post 302551239 by kurumi on Monday 29th of August 2011 09:23:21 PM
Old 08-29-2011
Code:
 $(cat file);echo $data | rev | sed "s/LLA NOINU//;s/@@/\'/g" | rev

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing the last occurance of string

I have a small query. I have a file containing the following lines abcd<12></12>fdfgdf<12>sdfgfg<12> sdfsdf<12></12>ytunfg<12> hggfhf<12>rtysb<12>zdfgdfg<12> Now I wish to delete ONLY the last occurance of string <12> from every lines of code. That mease my final output will be like this:... (7 Replies)
Discussion started by: dkhanna01
7 Replies

2. UNIX for Dummies Questions & Answers

count string occurance in a file hourly

Hi, I file that has all the status for one day (24hours). Now what I want to do is to count the occurence of a string in its output hourly like for example count occurance of successful or asynchronous clear destinon for every hour and redirect it to file. Please see sample file below. Please... (2 Replies)
Discussion started by: ayhanne
2 Replies

3. UNIX for Dummies Questions & Answers

String search - Command to find second occurance

Hi, I am new to Unix world. Is there any command which can directly return the second occurance of a particular string in a file? Basically, I want to read the contents of the file from the second occurance of a particualr string. Can be implemented using a loop, but am just wondering if there... (5 Replies)
Discussion started by: saurabhsinha23
5 Replies

4. Shell Programming and Scripting

How can I match lines with just one occurance of a string in awk?

Hi, I'm trying to match records using awk which contain only one occurance of my string, I know how to match one or more (+) but matching only one is eluding me without developing some convoluted bit of code. I was hoping there would be some simple pattern matching thing similar to '+' but... (9 Replies)
Discussion started by: jonathanm
9 Replies

5. UNIX for Dummies Questions & Answers

Removing a string of text from a file - help please

Hey Folks, I have a file that contains data that I am working with, sometimes this file has a very long string of text that messes with an awk command in a script i am trying to build. I would like to cut this string of text out of a file and then redirect everything except that string to a new... (5 Replies)
Discussion started by: deepslp
5 Replies

6. Shell Programming and Scripting

extract till occurance of a string

hi , i have an xml that comes in a single, the entire xml file is read as a single line when i open in edit plus or unix. i need to amend the contents of this xml file. below is the extract from the file <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"... (5 Replies)
Discussion started by: sais
5 Replies

7. Shell Programming and Scripting

replace every second occurance of a string

I want to replace every 2nd occurance of a string/character from a line. ababacbsbddbsbbcbdbssb i want to replace every s2nd b with @ like below should be like aba@acbs@ddbs@bc@dbss@ (3 Replies)
Discussion started by: ratheeshjulk
3 Replies

8. Windows & DOS: Issues & Discussions

Removing anything from text file except specific string

So, I have a text file that looks like this: 0,0: (168,168,176) #A8A8B0 srgb(168,168,176) 1,0: (168,168,176) #A8A8B0 srgb(168,168,176) 2,0: (166,166,174) #A6A6AE srgb(166,166,174) 3,0: (166,166,174) #A6A6AE srgb(166,166,174) 4,0: (168,168,176) #A8A8B0 srgb(168,168,176) 5,0:... (0 Replies)
Discussion started by: pasc
0 Replies

9. Shell Programming and Scripting

[Need help] perl script to find the occurance of string from a text file

I have two files 1. input.txt 2. keyword.txt input.txt has contents like .src_ref 0 "call.s" 24 first 0x000000 0x5a80 0x0060 BRA.l 0x60 .src_ref 0 "call.s" 30 first 0x000002 0x1bc5 RETI .src_ref 0 "call.s" 31 first 0x000003 0x6840 ... (2 Replies)
Discussion started by: acdc
2 Replies

10. UNIX for Beginners Questions & Answers

Insert text after the first occurance of searched string entry in a file

My server xml file has huge data part of which i'm sharing below. I wish to add the below text held by variable "addthisline" after the closing braces i.e --> once the first </Connector> tag is found. addthisline="I need to be inserted after the comments" Thus my searchstring is... (3 Replies)
Discussion started by: mohtashims
3 Replies
RCS(1)							      General Commands Manual							    RCS(1)

NAME
rcs - change RCS file attributes SYNOPSIS
rcs [ options ] file ... DESCRIPTION
Rcs creates new RCS files or changes attributes of existing ones. An RCS file contains multiple revisions of text, an access list, a change log, descriptive text, and some control attributes. For rcs to work, the caller's login name must be on the access list, except if the access list is empty, the caller is the owner of the file or the superuser, or the -i option is present. Files ending in `,v' are RCS files, all others are working files. If a working file is given, rcs tries to find the corresponding RCS file first in directory ./RCS and then in the current directory, as explained in co (1). -i creates and initializes a new RCS file, but does not deposit any revision. If the RCS file has no path prefix, rcs tries to place it first into the subdirectory ./RCS, and then into the current directory. If the RCS file already exists, an error mes- sage is printed. -alogins appends the login names appearing in the comma-separated list logins to the access list of the RCS file. -Aoldfile appends the access list of oldfile to the access list of the RCS file. -e[logins] erases the login names appearing in the comma-separated list logins from the access list of the RCS file. If logins is omitted, the entire access list is erased. -cstring sets the comment leader to string. The comment leader is printed before every log message line generated by the keyword $Log$ during checkout (see co). This is useful for programming languages without multi-line comments. During rcs -i or initial ci, the comment leader is guessed from the suffix of the working file. -l[rev] locks the revision with number rev. If a branch is given, the latest revision on that branch is locked. If rev is omitted, the latest revision on the trunk is locked. Locking prevents overlapping changes. A lock is removed with ci or rcs -u (see below). -u[rev] unlocks the revision with number rev. If a branch is given, the latest revision on that branch is unlocked. If rev is omitted, the latest lock held by the caller is removed. Normally, only the locker of a revision may unlock it. Somebody else unlocking a revision breaks the lock. This causes a mail message to be sent to the original locker. The message contains a commentary solicited from the breaker. The commentary is terminated with a line containing a single `.' or control-D. -L sets locking to strict. Strict locking means that the owner of an RCS file is not exempt from locking for checkin. This option should be used for files that are shared. -U sets locking to non-strict. Non-strict locking means that the owner of a file need not lock a revision for checkin. This option should NOT be used for files that are shared. The default (-L or -U) is determined by your system administrator. -nname[:rev] associates the symbolic name name with the branch or revision rev. Rcs prints an error message if name is already associated with another number. If rev is omitted, the symbolic name is deleted. -Nname[:rev] same as -n, except that it overrides a previous assignment of name. -orange deletes ("outdates") the revisions given by range. A range consisting of a single revision number means that revision. A range consisting of a branch number means the latest revision on that branch. A range of the form rev1-rev2 means revisions rev1 to rev2 on the same branch, -rev means from the beginning of the branch containing rev up to and including rev, and rev- means from revision rev to the end of the branch containing rev. None of the outdated revisions may have branches or locks. -q quiet mode; diagnostics are not printed. -sstate[:rev] sets the state attribute of the revision rev to state. If rev is omitted, the latest revision on the trunk is assumed; If rev is a branch number, the latest revision on that branch is assumed. Any identifier is acceptable for state. A useful set of states is Exp (for experimental), Stab (for stable), and Rel (for released). By default, ci sets the state of a revision to Exp. -t[txtfile] writes descriptive text into the RCS file (deletes the existing text). If txtfile is omitted, rcs prompts the user for text supplied from the std. input, terminated with a line containing a single `.' or control-D. Otherwise, the descriptive text is copied from the file txtfile. If the -i option is present, descriptive text is requested even if -t is not given. The prompt is suppressed if the std. input is not a terminal. DIAGNOSTICS
The RCS file name and the revisions outdated are written to the diagnostic output. The exit status always refers to the last RCS file operated upon, and is 0 if the operation was successful, 1 otherwise. FILES
The caller of the command must have read/write permission for the directory containing the RCS file and read permission for the RCS file itself. Rcs creates a semaphore file in the same directory as the RCS file to prevent simultaneous update. For changes, rcs always cre- ates a new file. On successful completion, rcs deletes the old one and renames the new one. This strategy makes links to RCS files use- less. IDENTIFICATION
Author: Walter F. Tichy, Purdue University, West Lafayette, IN, 47907. Revision Number: 3.1 ; Release Date: 83/04/04 . Copyright (C) 1982 by Walter F. Tichy. SEE ALSO
co (1), ci (1), ident(1), rcsdiff (1), rcsintro (1), rcsmerge (1), rlog (1), rcsfile (5), sccstorcs (8). Walter F. Tichy, "Design, Implementation, and Evaluation of a Revision Control System," in Proceedings of the 6th International Conference on Software Engineering, IEEE, Tokyo, Sept. 1982. BUGS
Purdue University 6/29/83 RCS(1)
All times are GMT -4. The time now is 05:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy