Search Results

Search: Posts Made By: fongthai
7,473
Posted By fongthai
Thanks Don, You're more than expected pointing...
Thanks Don,
You're more than expected pointing out my requirement changed, showing your script and explain the different comparing to Ravinder's one. Perfect!

The reason I changed it just to make...
7,473
Posted By fongthai
Thanks, That works well, but not easy to...
Thanks,

That works well, but not easy to understand, can you clear my mind :) please
Thanks.
7,473
Posted By fongthai
input.txt To make it easier, let assume...
input.txt

To make it easier, let assume xyz=2
So, I want look for the PIN line, then move it next xyz line (meaning: move it to next 2 lines)
The output should be like this:

line_before_pin_1...
7,473
Posted By fongthai
Hi itkamaraj, Where is the line_num coming...
Hi itkamaraj,

Where is the line_num coming from?

And you may mis-understand my initial post: the condition is based on another variable $xyz - not the data from file or $line
7,473
Posted By fongthai
Append a line "while read line"
Hello everyone,

I want to process a data file using bash, I would like add a new line RIGHT after the time when i know "another variable met a value"

Like this:

while read line
do
...
...
5,807
Posted By fongthai
The best way is to use "dos2unix" command to...
The best way is to use "dos2unix" command to convert files has ^M character to standard unix format.
16,416
Posted By fongthai
hmm, -o is great, I can change to ps -eo...
hmm, -o is great, I can change to ps -eo command,user
But if the command is long it'll be truncated.
ps -eo command:200,user
200 is a custom length for "command" can show, but we will face...
16,416
Posted By fongthai
reformat ps output
I often use "ps -ef" command to list all running processes. Now i want to customize the output to show only 2 parts: CMD and UID as below:

/bin/bash /usr/bin/run-parts /etc/cron.weekly root...
9,554
Posted By fongthai
any idea are welcome.
any idea are welcome.
12,518
Posted By fongthai
this could help you: ...
this could help you:
https://www.unix.com/shell-programming-scripting/17010-how-validate-ip-address.html
9,554
Posted By fongthai
nohup within a pipe
Dear,

I have a script to start tomcat. I post here the main part of that script - called mytomcat.bash

function start()
{
shift
trap "" HUP
/usr/local/java/bin/java ...
5,608
Posted By fongthai
It's great, Yogesh! Thank for your help!
It's great, Yogesh!

Thank for your help!
5,608
Posted By fongthai
get next 2 lines after a "pattern line"
all,

I want to get next 2 lines in a file after a define pattern, for example: SALT

Input:


Output:


anyone can help?
13,997
Posted By fongthai
OKie, got it work with --line-buffered option in...
OKie, got it work with --line-buffered option in grep.
Sorry, I was not carefully read it.

a million thanks!
13,997
Posted By fongthai
You answer: But I still keep the idea of...
You answer:


But I still keep the idea of using grep then redirect to file.

My feedback:
13,997
Posted By fongthai
era, have you got any solution for it?
era, have you got any solution for it?
13,997
Posted By fongthai
@era: Yes, I can see the result on the screen...
@era: Yes, I can see the result on the screen without redirection.
I left it run for half a day (without grep), and kill it, I got the output with over 200MB
13,997
Posted By fongthai
era, top -b will run looping, of course. I...
era,

top -b will run looping, of course. I will use, for example: "top -b -d 10" it will refresh every 10 seconds.
13,997
Posted By fongthai
Yes, I got them. I don't want to get data first...
Yes, I got them.
I don't want to get data first then using grep, because it make output file become a huge file. I want to run top -b for one or two days, that's the issue.
13,997
Posted By fongthai
top -b | grep ^Cpu output is sure no error, it...
top -b | grep ^Cpu output is sure no error, it output should be like this:

"Cpu(s): 1.7%us, 0.8%sy, 0.0%ni, 96.9%id, 0.5%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu(s): 0.0%us, 1.3%sy, 0.0%ni,...
13,997
Posted By fongthai
no data redirected to a file with top and grep - why?
HI all,

I want to capture cpu data in batch mode of "top" command and redirect to a file like this:
top -b > cpu.dat
it works!
But I want to capture only Cpu lines, so i have:
top -b | grep...
3,380
Posted By fongthai
delete some lines
I want to delete any line in my data file that have a certain starting letter (./) as the next line, if the next line has difference starting letter (not "./") please keep it.

Ex Input:
...
2,845
Posted By fongthai
Yah, it's great! Thank Ygor!
Yah, it's great!
Thank Ygor!
2,845
Posted By fongthai
Thank you, It works fine, except the last...
Thank you,

It works fine, except the last item!
But it's OK.
2,845
Posted By fongthai
find an available item in array
Dear all,

I'm have a sorted array like this:
177
220
1001
2000
2001
2003
2005
notice that 2002 and 2004 are NOT in array.

Then user input a number INPUT, our script should return OUTPUT...
Showing results 1 to 25 of 59

 
All times are GMT -4. The time now is 05:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy