1. The problem statement, all variables and given/known data:
I have a file with a fragment of a novel, which I have to clear from punctuation and sort all the words contained one per line and non duplicated, all this going to a file called "palabras".
Here is fragment of the input file:
And here is a fragment of how the file palabras should look like:
2. Relevant commands, code, scripts, algorithms:
3. The attempts at a solution (include all code and scripts):
Surfing on the web to find information, i have only achieved to clear punctuation and put a word in each line, with the following code:
calling it from terminal with this: cat novela | awk -f p4
p4 is the name of the file of my code.
and when i call from terminal this command: sort -u palabras>palabras2 it generates the file i want (if i put palabras>palabras it generates a blank file)
the question here is, how can i achieve my goal with in the same awk program? cuz i tried this:
With and without END, with sort -u > palabras2 and with sort -u palabras, however the file generated is the same without sorting and without deleting duplicated words.
I would really appreciate any ideas because I have been stucked on this problem for days. Also if you could suggest ideas, where i can call the awk like I said before ( cat novela | awk -f p4).
Thank you in advance.
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
ITESM Campus Monterrey, Monterrey, Mexico
Profesor: Juan Jose Icaza
Course: Laboratorio de Sistemas Operativos
Scrutinizer: Mmm could you provide me an example of a code to sort inside itself? Im new to this language because it is just a lab session of several lab sessions in a whole semester, so it would be very helpful.
And Lucas_0148, I dont really know the version, how could i get it? I just create a file and write inside it, and then execute it from terminal, in a fresh ubuntu installation.
I'm trying to create a shell script that takes a awk script that I wrote and a filename as an argument. I was able to get that done but I'm having trouble figuring out how to keep the header of the output at the top but sort the rest of the rows alphabetically. This is what I have now but it is... (1 Reply)
I am new to shell scripting. I am interested how to know how to sort a content of a file using shell scripting.
I've attached the 'Input file' and the 'expected output' to this thread.
Details provided in the expected output file will provide details on how the sort needs to be done.
... (16 Replies)
I need somebody who could help with an exercise.
You have a text file called users.txt with this info inside:
users.txt:
user1:1234:/home/homedir1 ;
user2:1234:/home/homedir2 ;
user3:1234:/home/homedir3 ;
user4:1234:/home/homedir4 ;
The script should create an user using the... (2 Replies)
originally the shellscript
#ln_file_name=`echo $ld_interface_date"_"${8}".csv"`
#ln_file_name=`echo 201202011527_HL_HLTM1_B04A.csv`
ln_file_name="*"`echo ${7}".csv"`
get_file_list_1=$log_path"tm1_file_list.gfl1"
cd ${source_path}
echo "Try to find any file exist in the... (10 Replies)
Hello,
I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this :
This is the output of ls command : I stored the output in a file filelist
1.1M... (5 Replies)
Hello,
I have a text file which has list of SQL Commands, from where I have grepped the lines where there is a specific string:
grep <string> <file1> >> <file2>
A sample of the file2 is:
INSERT INTO PS_PWC_SP_ERN_DATA SELECT A.EMPLID ,B.COMPANY ,B.PAYGROUP ,
B.OTH_PAY FROM... (7 Replies)
Hi to all,
anyway to create shell script to sort informations from one file and create new file with the sorted values?
from file 30days.out
-bash-3.00# more 30days.out
user/str4@kl.com/INBOX
user/tg1@johor.com/INBOX
user/tg2@kedah.com/INBOX
user/tg3@titangroup.com/INBOX... (3 Replies)
Hello,
I have a log file with the following input:
X , ID , Date, Time, Y
01,01368,2010-12-02,09:07:00,Pass
01,01368,2010-12-02,10:54:00,Pass
01,01368,2010-12-02,13:07:04,Pass
01,01368,2010-12-02,18:54:01,Pass
01,01368,2010-12-03,09:02:00,Pass
01,01368,2010-12-03,13:53:00,Pass... (12 Replies)
Hello All,
I am creating a shell script that reads a file(test.txt) with the following data,
0.0.0.0
10.10.10.0
10.10.10.1
10.10.10.10
10.10.10.2
10.10.10.3
10.10.10.4
10.10.10.5
10.10.10.6
10.10.10.7
10.10.10.8
10.10.10.9
If I use the sort, the highest value I am getting is... (1 Reply)
I have a file with four fields and an awk script that strips out one field displaying the remaining three. I have added headings for each of these fields such as Player - Year - RBIs then below it comes the data. What I am trying to do is sort the RBIs field in my script from most to least at the... (9 Replies)