Sponsored Content
Top Forums Shell Programming and Scripting Remove not only the duplicate string but also the keyword of the string in Perl Post 302892381 by disedorgue on Wednesday 12th of March 2014 01:26:49 PM
Old 03-12-2014
Hi,
you can use this way:
Code:
$ cat in.txt
Linux   Unix   Linux  Windows SUN
MACOS  SUN  SUN HP-AUX
$ perl -sane 'foreach $i (@F) { $X{$i}+=1 } ; foreach $i (@F) {printf "%s ",$i if $X{$i}==1 };print "\n";%X=""' in.txt
Unix Windows SUN
MACOS HP-AUX

Regards.

Last edited by disedorgue; 03-12-2014 at 05:10 PM..
This User Gave Thanks to disedorgue For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Match keyword on string and substitute under vi

Hi guys, with sed when I need to make a substitution inside a line containing a specific keyword, I usually use: sed '/keyword/ s/cat/dog/g' This will substitute "cat" with "dog" on those lines containing "keyword". Now I want to use this inside vi, for several reason that I cannot... (2 Replies)
Discussion started by: lycaon
2 Replies

2. Shell Programming and Scripting

How to remove duplicate sentence/string in perl?

Hi, I have two strings like this in an array: For example: @a=("Brain aging is associated with a progressive imbalance between intracellular concentration of Reactive Oxygen Species","Brain aging is associated with a progressive imbalance between intracellular concentration of Reactive... (9 Replies)
Discussion started by: vanitham
9 Replies

3. Shell Programming and Scripting

Remove duplicate files based on text string?

Hi I have been struggling with a script for removing duplicate messages from a shared mailbox. I would like to search for duplicate messages based on the “Message-ID” string within the messages files. I have managed to find the duplicate “Message-ID” strings and (if I would like) delete... (1 Reply)
Discussion started by: spangberg
1 Replies

4. Shell Programming and Scripting

filtering out duplicate substrings, regex string from a string

My input contains a single word lines. From each line data.txt prjtestBlaBlatestBlaBla prjthisBlaBlathisBlaBla prjthatBlaBladpthatBlaBla prjgoodBlaBladpgoodBlaBla prjgood1BlaBla123dpgood1BlaBla123 Desired output --> data_out.txt prjtestBlaBla prjthisBlaBla... (8 Replies)
Discussion started by: kchinnam
8 Replies

5. Shell Programming and Scripting

remove characters from string based on occurrence of a string

Hello Folks.. I need your help .. here the example of my problem..i know its easy..i don't all the commands in unix to do this especiallly sed...here my string.. dwc2_dfg_ajja_dfhhj_vw_dec2_dfgh_dwq desired output is.. dwc2_dfg_ajja_dfhhj it's a simple task with tail... (5 Replies)
Discussion started by: victor369
5 Replies

6. Shell Programming and Scripting

Remove duplicate chars and sort string [SED]

Hi, INPUT: DCBADD OUTPUT: ABCD The SED script should alphabetically sort the chars in the string and remove the duplicate chars. (5 Replies)
Discussion started by: jds93
5 Replies

7. Shell Programming and Scripting

Remove lines between the start string and end string including start and end string Python

Hi, I am trying to remove lines once a string is found till another string is found including the start string and end string. I want to basically grab all the lines starting with color (closing bracket). PS: The line after the closing bracket for color could be anything (currently 'more').... (1 Reply)
Discussion started by: Dabheeruz
1 Replies

8. Shell Programming and Scripting

Remove multiple lines from a particular string to particular string

Hi, I have a file containing the DDLs of tables in a schema. From that I need to remove all the lines from a starting string till a specific string. Here is an example. File1.txt ------------- CREATE TABLE "SCHEMA1"."LKP11_TBL_USERS" ( "ID" NUMBER(8,0) NOT NULL ENABLE, "USER_ID"... (3 Replies)
Discussion started by: satyaatcgi
3 Replies

9. Shell Programming and Scripting

Remove string perl with first or last word is in a list

Hello, I try to delete all strings if their first or last word is one of this list of words : "the", "i", "in", "there", "this", "with", "on", "we", "that", "of" For example if i have this string in an input file "with me" this string will be removed, Example: input "the european... (2 Replies)
Discussion started by: cyrine
2 Replies

10. Shell Programming and Scripting

Remove duplicate consecutive lines with specific string

Hello, I'm trying to remove the duplicate consecutive lines with specific string "WARNING". File.txt abc; WARNING 2345 WARNING 2345 WARNING 2345 WARNING 2345 WARNING 2345 bcd; abc; 123 123 123 WARNING 1234 WARNING 2345 WARNING 2345 efgh; (6 Replies)
Discussion started by: Mannu2525
6 Replies
img-sun(n)																img-sun(n)

NAME
img-sun - Img, Sun Raster Format (sun) SYNOPSIS
package require Tk package require img::sun ?1.3? image create photo ?name? ?options? DESCRIPTION
The package img::sun is a sub-package of Img. It can be loaded as a part of the complete Img support, via package require Img, or on its own, via package require img::sun. Like all packages of Img it does not provide new commands, but extends the existing Tk command image so that it supports files containing raster images in the Sun Raster Format (sun). More specifically img::sun extends Tk's photo image type. The name of the new format handler is sun. This handler provides new additional configuration options. See section SUN OPTIONS for more detailed explanations. All of the above means that in a call like image create photo ?name? ?options? [1] Image data in sun format (options -data and -file) is detected automatically. [2] The format name sun is recognized by the option -format. In addition the value for the option is treated as list and may contain any of the special options listed in section SUN OPTIONS. SUPPORTED SUN TYPES
1-bit pixels: Black and White. 8-bit pixels: Grayscale or indexed. 24-bit pixels: True-color (RGB, each channel 8 bit). 32-bit pixels: True-color with alpha channel (RGBA, each channel 8 bit). List of currently supported features: Type | Read | Write | | -file | -data | -file | -data | ---------------------------------------- 1-bit | Yes | Yes | No | No | 8-bit | Yes | Yes | No | No | 24-bit | Yes | Yes | Yes | Yes | 32-bit | Yes | Yes | Yes | Yes | All images types may be either uncompressed or run-length encoded. SUN OPTIONS
The handler provides the following options: -verbose bool This option is supported for reading and writing. If set to true, additional information about the loaded/stored image is printed to stdout. Default is false. -compression type This option is supported for writing only. Set the compression mode to either none or rle. Default is rle. -matte bool This option is supported for reading and writing. If set to false, a matte (alpha) channel is ignored during reading or writing. Default is true. SEE ALSO
img-bmp, img-gif, img-ico, img-intro, img-jpeg, img-pcx, img-pixmap, img-png, img-ppm, img-ps, img-sgi, img-sun, img-tga, img-tiff, img- window, img-xbm, img-xpm KEYWORDS
image handling, sun, tk COPYRIGHT
Copyright (c) 1995-2003 Jan Nijtmans <nijtmans@users.sourceforge.com> Img 1.3 img-sun(n)
All times are GMT -4. The time now is 04:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy