04-07-2009
delete two patterns and remove one pattern
Friends,
I have .txt file with following format.
START
ABC|Prashant1|Patel1
ABC|Prashant2|Patel2
ABC|Prashant1|Patel1
ABC|Prashant2|Patel2
END
I would like to do:
1) Delete line with START
2) Delete line with END
3) Remove ABC|
4) Delete duplicate records
The following command works fine which deletes line with START and END
sed -e /^START/d -e /^END/d Filename.txt
How do I incorporate task 3 and 4?
NOTE: The file will have more than 500,000 thousand rows.
Thanks in advance for suggestion,
Prashant
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have file 1.txt with following entries as shown:
0152364|134444|10.20.30.40|015236433
0233654|122555|10.20.30.50|023365433
**
**
**
In file 2.txt I have the following entries as shown:
0152364|134444|10.20.30.40|015236433
0233654|122555|10.20.30.50|023365433... (4 Replies)
Discussion started by: imas
4 Replies
2. Shell Programming and Scripting
I want to delete lines like this
sed '/FROM_HERE/,/TO_HERE/d'
but I would like to *not* delete the second match, i.e. the TO_HERE line. How can I achieve this?
Thank you! (1 Reply)
Discussion started by: Ilja
1 Replies
3. Shell Programming and Scripting
Hi, I've searched in this forum all day long but was not able to find enough codes to help me do a task. The only code that I can come up with is this:
sed '/ /,/ /{//p;d;}' inputfile > outputfile
I would like to sed/awk/grep a file for two patterns and then delete the lines between... (4 Replies)
Discussion started by: shamushamu
4 Replies
4. Shell Programming and Scripting
Hi,
I am using following code to remove words between start and end points.
$mystring = "The start text always precedes the end of the end text.";
if($mystring =~ s/start(.*)end/\0/) {
print $1;
print "\n";
print $mystring;
}
But this is writing special chars in place of... (1 Reply)
Discussion started by: sarbjit
1 Replies
5. Shell Programming and Scripting
Hello sed gurus. I am using ksh on Sun and have a file created by concatenating several other files. All files contain header rows. I just need to keep the first occurrence and remove all other header rows.
header for file
1111
2222
3333
header for file
1111
2222
3333
header for file... (8 Replies)
Discussion started by: gary_w
8 Replies
6. Shell Programming and Scripting
Need to remove rest of line after the equals sign on search pattern from the searchfile. Can anybody help. Couldn't find any similar example in the forum:
infile:
64_1535: Delm. = 86 var, aaga
64_1535: Fran. = 57 ex. ccc
64_1639: Feb. = 26 (link). def
64_1817: mar. = 3/4. drz ... (7 Replies)
Discussion started by: sdf
7 Replies
7. Shell Programming and Scripting
Hi,
i need help to delete all the lines between 2 matched patterns and the first pattern must be deleted too. sample as follows:
inputfile.txt
>kump_1
...........................
...........................
>start_0124
dgfhghgfh
fgfdgfh
fdgfdh
>kump_2
............................. (7 Replies)
Discussion started by: redse171
7 Replies
8. Shell Programming and Scripting
Hi,
How can i delete values between 2 patterns like below:-
input.txt
192.1.1.2.22 blablabala
23.1.A.1.2 blablabalbl
5.4.1.1.12 blablaba
i need to delete all values between starting from "." no 3 and second column. the output should be:
192.1.1 blablabala... (15 Replies)
Discussion started by: redse171
15 Replies
9. Shell Programming and Scripting
Delete patterns matching
OS version: RHEL 7.3
Shell : Bash
I have a file like below (pattern.txt). I need to delete all lines starting with the following words (words separated by comma below) and ) character.
LOGGING, NOCOMPRESS, TABLESPACE , PCTFREE, INITRANS, MAXTRANS, STORAGE,... (3 Replies)
Discussion started by: John K
3 Replies
10. Shell Programming and Scripting
I have a file
Line 1 a
Line 22
Line 33
Line 1 b
Line 22
Line 1 c
Line 4
Line 5
I want to delete all lines before last occurrence of a line which contains something which is defined in a variable. Say a variable var contains 'Line 1', then I need the following in the output.
... (21 Replies)
Discussion started by: Soham
21 Replies
LEARN ABOUT REDHAT
kas_stringtokey
KAS_STRINGTOKEY(8) AFS Command Reference KAS_STRINGTOKEY(8)
NAME
kas_stringtokey - Converts a character string into an octal key
SYNOPSIS
kas stringtokey -string <password string>
[-cell <cell name>] [-help]
kas str -s <password string> [-c <cell name>] [-h]
DESCRIPTION
The kas stringtokey command converts the character string specified with the -string argument into an octal string suitable for use as an
encryption key.
The kas command interpreter generates the octal key by using an encryption algorithm on the combination of the specified string and the
name of the local cell (as recorded in the local /etc/openafs/ThisCell file). Use the -cell argument to convert a string into a key
appropriate for a cell other than the local one.
CAUTIONS
This command writes the key to the standard output stream, on which it can possibly be intercepted by third parties. It is not very secure
to use the key in an actual Authentication Database entry.
OPTIONS
-string <password string>
Specifies the character string to convert into an octal key.
-cell <cell name>
Specifies the complete Internet domain name of the cell to combine with the password string while generating the key. If this argument
is omitted, the kas command interpreter determines the name of the local cell by consulting:
o First, the value of the environment variable AFSCELL.
o Second, the cellname in the /etc/openafs/ThisCell file on the local machine.
-help
Prints the online help for this command. All other valid options are ignored.
OUTPUT
The output is of the following form:
Converting I<password string> in realm 'I<cell_name>' yields key='I<key>'.
EXAMPLES
The following example shows the octal key equivalent of the string "new_pswd" in the ABC Corporation cell.
% kas stringtokey new_pswd
Converting new_pswd in realm 'ABC.COM' yields
key='346307364320263233342354'.
PRIVILEGE REQUIRED
None, and no password is required.
SEE ALSO
ThisCell(5), kas(8)
COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.
This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas
Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.
OpenAFS 2012-03-26 KAS_STRINGTOKEY(8)