searching text in a file remotely

Multi tool use
I have log files, based on Linux servers, and I'm working on Windows OS.
I'm using Filezilla to log in the Linux server and searching specific text or strings by open the log file.
I want to automate this process using batch in Windows, I tried using below;
@echo off
cls
set /p string="Enter the string: "
echo open xx.xx.xx.xx 21> ftpc.dat
echo xxxxxxxx>> ftpc.dat
echo xxxxxxxx>> ftpc.dat
echo bin >> ftpc.dat
echo grep '%string%' /PATH IS HERE/log.log >> ftpc.dat
ftp -s:ftpc.dat
I'm just new to that, I want ideas on that, how I automate this search process? where I can make a search tool for any text, that this tool goes and find specific file in linux server and shows the results in lines (before/after 15 lines) of thatsearch results.
Do I need to write bash scripts, or I can do this basic script in batch file as above to show or output the results?
linux windows shell batch-file ftp
|
show 1 more comment
I have log files, based on Linux servers, and I'm working on Windows OS.
I'm using Filezilla to log in the Linux server and searching specific text or strings by open the log file.
I want to automate this process using batch in Windows, I tried using below;
@echo off
cls
set /p string="Enter the string: "
echo open xx.xx.xx.xx 21> ftpc.dat
echo xxxxxxxx>> ftpc.dat
echo xxxxxxxx>> ftpc.dat
echo bin >> ftpc.dat
echo grep '%string%' /PATH IS HERE/log.log >> ftpc.dat
ftp -s:ftpc.dat
I'm just new to that, I want ideas on that, how I automate this search process? where I can make a search tool for any text, that this tool goes and find specific file in linux server and shows the results in lines (before/after 15 lines) of thatsearch results.
Do I need to write bash scripts, or I can do this basic script in batch file as above to show or output the results?
linux windows shell batch-file ftp
Is it okay for you to install PuTTY on your Windows computer?
– wallyk
Dec 31 '18 at 18:59
@wallyk, then it will be off-topic as it will request off-site resource!
– double-beep
Dec 31 '18 at 19:31
Good to keep the rules in mind, but, ultimately, expeditiously finding a useful solution is the more important consideration.
– wallyk
Dec 31 '18 at 20:06
I think this is off-topic and should be closed...
– double-beep
Dec 31 '18 at 20:52
Hi @wallyk I dont want to solve this using putty, I know with putty, can grep that easily, I need a search utility, and need to script that. ITs not only one file, its many file, but I need the script for one file then apply to other files, and other servers ..
– HKLM
Jan 1 at 3:51
|
show 1 more comment
I have log files, based on Linux servers, and I'm working on Windows OS.
I'm using Filezilla to log in the Linux server and searching specific text or strings by open the log file.
I want to automate this process using batch in Windows, I tried using below;
@echo off
cls
set /p string="Enter the string: "
echo open xx.xx.xx.xx 21> ftpc.dat
echo xxxxxxxx>> ftpc.dat
echo xxxxxxxx>> ftpc.dat
echo bin >> ftpc.dat
echo grep '%string%' /PATH IS HERE/log.log >> ftpc.dat
ftp -s:ftpc.dat
I'm just new to that, I want ideas on that, how I automate this search process? where I can make a search tool for any text, that this tool goes and find specific file in linux server and shows the results in lines (before/after 15 lines) of thatsearch results.
Do I need to write bash scripts, or I can do this basic script in batch file as above to show or output the results?
linux windows shell batch-file ftp
I have log files, based on Linux servers, and I'm working on Windows OS.
I'm using Filezilla to log in the Linux server and searching specific text or strings by open the log file.
I want to automate this process using batch in Windows, I tried using below;
@echo off
cls
set /p string="Enter the string: "
echo open xx.xx.xx.xx 21> ftpc.dat
echo xxxxxxxx>> ftpc.dat
echo xxxxxxxx>> ftpc.dat
echo bin >> ftpc.dat
echo grep '%string%' /PATH IS HERE/log.log >> ftpc.dat
ftp -s:ftpc.dat
I'm just new to that, I want ideas on that, how I automate this search process? where I can make a search tool for any text, that this tool goes and find specific file in linux server and shows the results in lines (before/after 15 lines) of thatsearch results.
Do I need to write bash scripts, or I can do this basic script in batch file as above to show or output the results?
linux windows shell batch-file ftp
linux windows shell batch-file ftp
asked Dec 31 '18 at 18:55
HKLMHKLM
23
23
Is it okay for you to install PuTTY on your Windows computer?
– wallyk
Dec 31 '18 at 18:59
@wallyk, then it will be off-topic as it will request off-site resource!
– double-beep
Dec 31 '18 at 19:31
Good to keep the rules in mind, but, ultimately, expeditiously finding a useful solution is the more important consideration.
– wallyk
Dec 31 '18 at 20:06
I think this is off-topic and should be closed...
– double-beep
Dec 31 '18 at 20:52
Hi @wallyk I dont want to solve this using putty, I know with putty, can grep that easily, I need a search utility, and need to script that. ITs not only one file, its many file, but I need the script for one file then apply to other files, and other servers ..
– HKLM
Jan 1 at 3:51
|
show 1 more comment
Is it okay for you to install PuTTY on your Windows computer?
– wallyk
Dec 31 '18 at 18:59
@wallyk, then it will be off-topic as it will request off-site resource!
– double-beep
Dec 31 '18 at 19:31
Good to keep the rules in mind, but, ultimately, expeditiously finding a useful solution is the more important consideration.
– wallyk
Dec 31 '18 at 20:06
I think this is off-topic and should be closed...
– double-beep
Dec 31 '18 at 20:52
Hi @wallyk I dont want to solve this using putty, I know with putty, can grep that easily, I need a search utility, and need to script that. ITs not only one file, its many file, but I need the script for one file then apply to other files, and other servers ..
– HKLM
Jan 1 at 3:51
Is it okay for you to install PuTTY on your Windows computer?
– wallyk
Dec 31 '18 at 18:59
Is it okay for you to install PuTTY on your Windows computer?
– wallyk
Dec 31 '18 at 18:59
@wallyk, then it will be off-topic as it will request off-site resource!
– double-beep
Dec 31 '18 at 19:31
@wallyk, then it will be off-topic as it will request off-site resource!
– double-beep
Dec 31 '18 at 19:31
Good to keep the rules in mind, but, ultimately, expeditiously finding a useful solution is the more important consideration.
– wallyk
Dec 31 '18 at 20:06
Good to keep the rules in mind, but, ultimately, expeditiously finding a useful solution is the more important consideration.
– wallyk
Dec 31 '18 at 20:06
I think this is off-topic and should be closed...
– double-beep
Dec 31 '18 at 20:52
I think this is off-topic and should be closed...
– double-beep
Dec 31 '18 at 20:52
Hi @wallyk I dont want to solve this using putty, I know with putty, can grep that easily, I need a search utility, and need to script that. ITs not only one file, its many file, but I need the script for one file then apply to other files, and other servers ..
– HKLM
Jan 1 at 3:51
Hi @wallyk I dont want to solve this using putty, I know with putty, can grep that easily, I need a search utility, and need to script that. ITs not only one file, its many file, but I need the script for one file then apply to other files, and other servers ..
– HKLM
Jan 1 at 3:51
|
show 1 more comment
2 Answers
2
active
oldest
votes
If you have a number of Linux servers to watch, it might be worth installing something like rsyslog or logstash. It's a big topic, but those might be good starting points in your research.
Other things to google: elasticsearch, kibana ... and their alternatives.
Hi ! Actually I have 7 remote servers, all linux based. my laptop is windows based, its restricted to install any software, I can only reach those linux servers using Filezilla or Putty, and there are couple of logs that I need them during my job for analyzing, I can use grep command to search for a text in some files, I was able to use mputty as its standalone tool without installing it. but still I need to have a search utlity that can search to a(text) within multiple servers. because sometimes I need to search for texts located in couple of last dated logs and shows 15 lines before/after
– HKLM
Jan 2 at 12:49
add a comment |
You cannot run grep
using FTP.
So either:
Use FTP to download whole file and grep/search it locally.
Or (as you seem to have an SSH access too) use a command-line SSH client to execute
grep
on the server. On Windows, you can use Plink (which comes with PuTTY):
plink -pw password user@example.com grep '%string%' /remote/path/log.log >
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53990588%2fsearching-text-in-a-file-remotely%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you have a number of Linux servers to watch, it might be worth installing something like rsyslog or logstash. It's a big topic, but those might be good starting points in your research.
Other things to google: elasticsearch, kibana ... and their alternatives.
Hi ! Actually I have 7 remote servers, all linux based. my laptop is windows based, its restricted to install any software, I can only reach those linux servers using Filezilla or Putty, and there are couple of logs that I need them during my job for analyzing, I can use grep command to search for a text in some files, I was able to use mputty as its standalone tool without installing it. but still I need to have a search utlity that can search to a(text) within multiple servers. because sometimes I need to search for texts located in couple of last dated logs and shows 15 lines before/after
– HKLM
Jan 2 at 12:49
add a comment |
If you have a number of Linux servers to watch, it might be worth installing something like rsyslog or logstash. It's a big topic, but those might be good starting points in your research.
Other things to google: elasticsearch, kibana ... and their alternatives.
Hi ! Actually I have 7 remote servers, all linux based. my laptop is windows based, its restricted to install any software, I can only reach those linux servers using Filezilla or Putty, and there are couple of logs that I need them during my job for analyzing, I can use grep command to search for a text in some files, I was able to use mputty as its standalone tool without installing it. but still I need to have a search utlity that can search to a(text) within multiple servers. because sometimes I need to search for texts located in couple of last dated logs and shows 15 lines before/after
– HKLM
Jan 2 at 12:49
add a comment |
If you have a number of Linux servers to watch, it might be worth installing something like rsyslog or logstash. It's a big topic, but those might be good starting points in your research.
Other things to google: elasticsearch, kibana ... and their alternatives.
If you have a number of Linux servers to watch, it might be worth installing something like rsyslog or logstash. It's a big topic, but those might be good starting points in your research.
Other things to google: elasticsearch, kibana ... and their alternatives.
answered Jan 1 at 23:38
wefwef
26327
26327
Hi ! Actually I have 7 remote servers, all linux based. my laptop is windows based, its restricted to install any software, I can only reach those linux servers using Filezilla or Putty, and there are couple of logs that I need them during my job for analyzing, I can use grep command to search for a text in some files, I was able to use mputty as its standalone tool without installing it. but still I need to have a search utlity that can search to a(text) within multiple servers. because sometimes I need to search for texts located in couple of last dated logs and shows 15 lines before/after
– HKLM
Jan 2 at 12:49
add a comment |
Hi ! Actually I have 7 remote servers, all linux based. my laptop is windows based, its restricted to install any software, I can only reach those linux servers using Filezilla or Putty, and there are couple of logs that I need them during my job for analyzing, I can use grep command to search for a text in some files, I was able to use mputty as its standalone tool without installing it. but still I need to have a search utlity that can search to a(text) within multiple servers. because sometimes I need to search for texts located in couple of last dated logs and shows 15 lines before/after
– HKLM
Jan 2 at 12:49
Hi ! Actually I have 7 remote servers, all linux based. my laptop is windows based, its restricted to install any software, I can only reach those linux servers using Filezilla or Putty, and there are couple of logs that I need them during my job for analyzing, I can use grep command to search for a text in some files, I was able to use mputty as its standalone tool without installing it. but still I need to have a search utlity that can search to a(text) within multiple servers. because sometimes I need to search for texts located in couple of last dated logs and shows 15 lines before/after
– HKLM
Jan 2 at 12:49
Hi ! Actually I have 7 remote servers, all linux based. my laptop is windows based, its restricted to install any software, I can only reach those linux servers using Filezilla or Putty, and there are couple of logs that I need them during my job for analyzing, I can use grep command to search for a text in some files, I was able to use mputty as its standalone tool without installing it. but still I need to have a search utlity that can search to a(text) within multiple servers. because sometimes I need to search for texts located in couple of last dated logs and shows 15 lines before/after
– HKLM
Jan 2 at 12:49
add a comment |
You cannot run grep
using FTP.
So either:
Use FTP to download whole file and grep/search it locally.
Or (as you seem to have an SSH access too) use a command-line SSH client to execute
grep
on the server. On Windows, you can use Plink (which comes with PuTTY):
plink -pw password user@example.com grep '%string%' /remote/path/log.log >
add a comment |
You cannot run grep
using FTP.
So either:
Use FTP to download whole file and grep/search it locally.
Or (as you seem to have an SSH access too) use a command-line SSH client to execute
grep
on the server. On Windows, you can use Plink (which comes with PuTTY):
plink -pw password user@example.com grep '%string%' /remote/path/log.log >
add a comment |
You cannot run grep
using FTP.
So either:
Use FTP to download whole file and grep/search it locally.
Or (as you seem to have an SSH access too) use a command-line SSH client to execute
grep
on the server. On Windows, you can use Plink (which comes with PuTTY):
plink -pw password user@example.com grep '%string%' /remote/path/log.log >
You cannot run grep
using FTP.
So either:
Use FTP to download whole file and grep/search it locally.
Or (as you seem to have an SSH access too) use a command-line SSH client to execute
grep
on the server. On Windows, you can use Plink (which comes with PuTTY):
plink -pw password user@example.com grep '%string%' /remote/path/log.log >
edited Jan 3 at 12:24
answered Jan 3 at 11:30
Martin PrikrylMartin Prikryl
88.1k22171374
88.1k22171374
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53990588%2fsearching-text-in-a-file-remotely%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
kQqEsx8 jCbztQ z2UlYjHIUYT6zsX4Qq23inDd4 y,JZYNl W,kTWr,n32 IG55TJ0muFwd aEZttr,iJRoO4WV24k6aq1rp8c5,CQn
Is it okay for you to install PuTTY on your Windows computer?
– wallyk
Dec 31 '18 at 18:59
@wallyk, then it will be off-topic as it will request off-site resource!
– double-beep
Dec 31 '18 at 19:31
Good to keep the rules in mind, but, ultimately, expeditiously finding a useful solution is the more important consideration.
– wallyk
Dec 31 '18 at 20:06
I think this is off-topic and should be closed...
– double-beep
Dec 31 '18 at 20:52
Hi @wallyk I dont want to solve this using putty, I know with putty, can grep that easily, I need a search utility, and need to script that. ITs not only one file, its many file, but I need the script for one file then apply to other files, and other servers ..
– HKLM
Jan 1 at 3:51