Grep from FileA, search in FileB, edit FileC > Output
Hello,
Similar question to my previous posts. I am sorry for the trouble...
Just checked my old threads but I can not implement any solution into this case..
My aim is to grab each line in fileA, check it in fileB and merge with fileC (tab separated) in corresponding line as given below:
FileA: just nba teams,
FileB: nba teams with a couple of team players (team-player-team-player-team-player)
FileC: my current file
Output: merged output
FileA:
FileB:
FileC:
Output:
Multiple loops caused intensive headache here..
I'd appreciate your help..
Edit: I am near to solution with awk.. Working on it...
I think that Vgersh's old post will do that...
test.awk
Solved: Even though file format is a bit different, it works with some extra manipulation.
I don't think that will fly. You seem to use underscores and spaces in team names inconsistently, don't set the correct OFS variable, and your file2 doesn't have a meaningful $2 in the structure that you show and describe.
Try instead
Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried:
grep -lr "this string" *
but I do not... (3 Replies)
Hello,
it would be great if someone can help me with the following:
I want to search for the rows from fileA in column 1 of fileB and output column 2 of fileB if found in fileC. In the moment I search within the complete file. How can I change the code so only column 1 is searched?
cat fileA... (7 Replies)
i have a file with some data and i need replace a perticular value with some other value from another another file
req:
file1.txt
abc,idle.txt,1234
file2.txt
5678
now the requirement is need to replace the "idle.txt" is with "mike_5678" here 5678 from file2.txt...
file2.txt contains only... (2 Replies)
Hi
I have two csv files, with the following formats:
FileA.log:
Application, This occured blah
Application, That occured blah
Application, Also this
AnotherLog, Bob did this
AnotherLog, Dave did that
FileB.log:
Uk, London, Application, datetime, LaterDateTime, Today it had'nt... (8 Replies)
Hi Everybody..
I'm a "newbie" to using Command-line... A few half-remembered DOS commands from 30 years ago, and the very handy "Sudo rm -R pathname" REMOVE command...
I do a lot of "cleaning" of plain-text OCR text files. with assorted common
line-break, punctuation and capitalization... (1 Reply)
Hi,
I am having a user.txt contains the name of users and passwd.txt file contains as passwd.txt
$cat usr.txt
root
bin
daemon
cap
$cat passwd.txt
root:x:0:0:root:/root:/usr/bin/ksh
bin:x:1:1:bin:/bin:/sbin/csh
daemon:x:2:2:daemon:/sbin:/usr/bin/ksh
adm:x:3:4:adm:/var/adm:/sbin/nologin... (4 Replies)
Hi I'm in the need of a script that basically takes two files and generates a 3rd. It reads from fileA and fileB and copies lines from fileA if they start by a word of fileB.
for example
fileA
The dog is beautful
Where is your cat
Why are you sad?
Help me!
fileB
The
Where
tree
dog... (4 Replies)
STEP 1
# Set variable
FILE=/tmp/mainfile
SEARCHFILE =/tmp/searchfile
# THIS IS THE MAIN FILE.
cat /tmp/mainfile
Interface Ethernet0/0 "outside", is up, line protocol is up
Hardware is i82546GB rev03, BW 100 Mbps
Full-Duplex(Full-duplex), 100 Mbps(100 Mbps)
MAC address... (6 Replies)
Hi All,
I want to edit a file using shell script..For ex...a file called /etc/passwd..here I am searching for "ftp" if it is there just change it to "tftp" without using any temporary file. (3 Replies)
Hi all,
can you please help me in this one..
i have a many scripts in a directory & i get many requests to change the code of a particular script.
for example file abc.txt contains
#!/bin/bash
mumbai 102403445
chennai 123980123
delhi 3456268468
kolkata 465376832
#kolkat 462945959
... (3 Replies)