I have problem with this for last few days and I would really be grateful if you can help me
I have sets of files in one directory, and each of them have few lines
each one of these lines has 1 or more occurrence of words
Y = [Dean James John Mark Bob]
I need to find the position of the Y in each line and put them into a file with number of the words in the whole line and name them $Y-$name
e.g. one file from directory --> file01.txt
this is the house for James and
Mark and Dean would like to
James want to test
Results
1) Jame-file01.txt
6
7
1
4
2) Mark-file01.txt
1
6
3) Dean-file01.txt
3
6
I have tried to do bits as well which is not helpful either
I have tried to put each line in a file and then break based on space and then get the line number as position using AWK (not very useful way of dealing as I end up with millions of files) and then I have tried following lines which is not working correctly either as they dont detect the names
can you please help me in this?
@bartus: i was geting may files as my approach was wrong (that was what I meant )
and now that I tried your line i get the following error... dont know where the problem is
Quote:
awk: (FILENAME=F1/Dean-Dean FNR=1) fatal: can't redirect to `and-F1/To-to' (No such file or directory)
@Pamu: what is file1 here?
if I am getting this right, I am calling the directroy in the first line and then I would need to call my parameters Y = [Dean James John Mark Bob]
can I do this you think?
I have a whole folder which they have pattens of 5 words of Y= [Dean James John Mark Bob], so I have 25 files with pattern of $Y-$Y
now in each one of these $Y-$Y i have lines that again which will again have $Y
now I need to get the pattern as $Y-$Y-$Y with will have only two columns
$1 = position of the words $Y
$2 = number of the words in each line
As I am new, I was dividing each line to a file and then break each word to new file and then get NR --- i know its funny but im learning
this is a mess and those not really do what I need for the naming which is adding the third parameter as well and has many separate files which need to be added up later...
I am looking for more appropriate way of doing it
@bartus: i was geting may files as my approach was wrong (that was what I meant )
and now that I tried your line i get the following error... dont know where the problem is
@Pamu: what is file1 here?
if I am getting this right, I am calling the directroy in the first line and then I would need to call my parameters Y = [Dean James John Mark Bob]
can I do this you think?
hi
file1 is having your words such as James, dean and so on..
Hi All,
I need one help to replace particular words in file based on if finds another words in that file .
i.e.
my self is peter@king.
i am staying at north sydney.
we all are peter@king.
How to replace peter to sham if it finds @king in any line of that file.
Please help me... (8 Replies)
Hi
I have the following file
# cat red
it.d-state = 50988 41498 45 0 0 0
it.age_buffer= 1500
it.dir = 1
I need to grep lines that are present after "="
But when I do so, few lines has more than one value and some has one
How to parse the line
I have used the follwing... (6 Replies)
Hi All
I have to search servers name say like 1000+ "unique names" line by line in child.txt files in another file that is a master file where all server present say "master.txt",if child.txt's server name matches with master files then it print yes else no with server name. (4 Replies)
Hello all
i tried awk , cut but i think something missing
i have this line
@@XYMONDCHK-V1|.acklist.|developer_instead|rendy_google_yagom|1323977582|1323979382|1323979382|1|admin|test case
i want cut some words to be in new line like this... (6 Replies)
Hello all
i know it is pretty hard one but you will manage it all
after noticing and calculating i find a rhythm for the file i want to edit
to copy the last 12 characters in line but the problem is to add after first 25 characters in same line
in other way too copy the last 12 characters... (10 Replies)
Hi
Im looking for a way, hopefully a one-liner to sort words in a line
e.g
"these are the words in a line"
to
"a are in line the these words"
Thanks! (15 Replies)
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)
I have some txt files. I have to create another text file which contains the portion starting from the format "Date Sex Address" to the end of the file. While using grep -n on Date it also gives me the previous line containg Date. and also Date may be DATE in some files.
My file is like this... (10 Replies)
The line is like this
+abc+def+mgh+ddsdsd+sa
i.e. words seperated by +. There is a plus in the beginning.
i want to conver this line to
abc, def, mgh, ddsdsd, sa
please provide the logic in the form of a shell script
Thanks in advance (3 Replies)