Crunch character combination and discard similar content
Hi guys !
I generated the power set of the set S={a,b,c} using crunch:
and get the 39 possible subsets:
As the order of the character in the string is not important, I am trying to get rid of the subsets containing the same characters and keep only one (see before: green, the one to keep; red the ones to discard).
In order to obtain:
Any language is fine.
If someone could put me on the track !
---------- Post updated at 08:04 PM ---------- Previous update was at 07:34 PM ----------
---------- Post updated at 09:15 PM ---------- Previous update was at 08:04 PM ----------
Another question related to this though with a slightly different input.
input:
How could I sort the first 2 fields (FS="|") horizontally and maintain the third one?
ouput:
I tried this but I don't understand how I can define an array without using the split function:
and:
returns:
Last edited by beca123456; 01-30-2015 at 12:11 AM..
It works here with 2 fields, however I am trying to use gawk asort function instead as I can have more than 2 fields to sort horizontally.
e.g.:
With your method it would be a massive code to write because of all possible combinations!
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
You are given a ANSI text file (a.txt) in the following format and with the following contents-:
NAME ROLL... (7 Replies)
Hi everyone,
I have UNIX this semester and I am just getting started with the commands. An interesting question came up while discussing the head and tail commands.
Suppose that I have text file with the following data in the following format-:
NAME ROLL MARKS
Sam 05 ... (2 Replies)
Hi,
I'd like to do an operation on text with a format like this
this line shall be numbered
this line shall not be numbered
this line shall also be numbered
this line shall not not be numbered
And I want an output like this
1 this line shall be numbered
this line... (6 Replies)
Hi all,
I'd like to search a file for the first occurence of the phrase "PLASTICS THAT EXPIRE" and then discard all the lines that came before it. Output the remainder to a new file. Operating system is hp-ux. I've searched for usual awk and sed one liners but can't find a solution.
Thank... (4 Replies)
hello all
i request you to give the solution for the following problem..
I want read the text file.and print the contents character by character..like if the text file contains google means..i want to print
g
go
goo
goog
googl
google
like this Using unix Shell scripting...
without using... (1 Reply)
Hi,
I'd get fields like
unix_linux_form_yyyyddmmhhmi.file.txt
shell_programming_and_scripting.txt
so on...
and want them as below
unix_linux_form
shell_programming_and
I could remove everything after a '.' as below
echo $field | sed 's/\..*//'
but how to remove... (14 Replies)
hi, I m stuck at a point for more than 3days. My doubt is pretty simple..
I have a web page content in $content. ( got this by using LWP)..
Now I want to display the content matching a pattern.
I tried
if($content =~ m{<div class="abc">(.*?)</div>}s){
print $1;}
that will... (4 Replies)
Hello all;
I've been having trouble completing a script (bash) because I can't get past the issue of finding a line in a file. For example, I have a file like this:
ddmmmyyyy Lon Lat
24may2003 -100.0 24.1
25may2003 -100.1 24.0
28may2003 -99.5 23.2
....etc... (4 Replies)