10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi Folks :)
I have a .txt file with thousands of words. I'm trying to sort the lines in order based on number of words per line.
Example
from:
word
word word word
word word
word word word word
word
word word word
word word
to desired output:
word (2 Replies)
Discussion started by: martinsmith
2 Replies
2. Shell Programming and Scripting
Hi all,
I have a file in which each string from column 1 is associated with one or multiple strings from column 2. For an example, in the sample input below, Gene1 from column1 is associated with two different strings from column 2 (BP1 and BP2).For every unique string from column 1, I need to... (9 Replies)
Discussion started by: AshwaniSharma09
9 Replies
3. Shell Programming and Scripting
Hi,
Please suggest a way to print number of words in the end of each line.
<input file>
red aunt house
blue sky
bat and ball game
<output file>
red aunt house 3
blue sky 2
bat and ball game 4
Thanks! (2 Replies)
Discussion started by: mira
2 Replies
4. UNIX for Advanced & Expert Users
I would like to cut words based on the word count of a line. This over here inspired me with some ideas but I wasn't able to get what I needed.
https://www.unix.com/shell-programming-scripting/105841-count-words-each-line-file-using-xargs.html
If the line has 6 words I would like to use this.... (8 Replies)
Discussion started by: cokedude
8 Replies
5. Shell Programming and Scripting
HI,
cat test
abc
echo "def" >> test
output is
cat test
abc
def
the needed output is
cat test
abc def
and so on (5 Replies)
Discussion started by: jobycxa
5 Replies
6. Shell Programming and Scripting
Hi experts
I need to pick 2 matched words from the same line.....
I have given below an example file
eg:
O14757 hsa04110 hsa04115 2 P38398 hsa04120 1
O15111 hsa04010 hsa04210 hsa04920 hsa04620 hsa04660 hsa04662 hsa05200 hsa05212 hsa05221 hsa05220 hsa05215 hsa05222 hsa05120 13 O14920... (4 Replies)
Discussion started by: binnybio
4 Replies
7. Shell Programming and Scripting
Hi, im having a problem with xargs, i want to cout word of each line in file, and i HAVE to use xargs, i tried:
cat file | xargs wc -w .....that uses all words in file like name of files and passed then to wc so it worte wc :somewordformfile is not i afile or directory
cat file | xargs -I{} wc... (3 Replies)
Discussion started by: Qwetek
3 Replies
8. Shell Programming and Scripting
hi
i have a line
"abc,def,ghi,abc,def ,ghi,abc,def,ghi,abc,def ,ghi,abc,def,ghi,abc"
I want to print the no of words, words separated by comma
please help (3 Replies)
Discussion started by: Satyak
3 Replies
9. Shell Programming and Scripting
can u help me out to print last two words of each sentence of a file.
for example.
contents of input file:
i love songs
my favourite songs
sent
songs all kind
good buddy
Ouput file should contain:
love songs
favourite songs
sent
all kind
good buddy (5 Replies)
Discussion started by: pradeepreddy
5 Replies
10. Shell Programming and Scripting
hi
i have a string like
str=abc def ghi jkl
now i want to count the no of words in the string
please help (7 Replies)
Discussion started by: satish@123
7 Replies