Search Results

Search: Posts Made By: karthikram
10,810
Posted By bakunin
Of course it is possible to use awk-scripts,...
Of course it is possible to use awk-scripts, sed-scripts, perl-scripts and probably another array of programmable text filters for this.

You might be interested to know that Unix offers a genuine...
10,810
Posted By RavinderSingh13
Hello, Following may help you. awk...
Hello,

Following may help you.


awk -F"|" '
FNR==NR ##### This condition will be true only when file1 will be read #####
{a[$1]=$0; ##### Here I am making array a whose index is...
10,810
Posted By Yoda
You didn't specify the field separator:- awk...
You didn't specify the field separator:-
awk -F\| '
NR == FNR {
T = $0
sub(/[^|]*/, X, T)
A[$1] = T
next
}
...
10,810
Posted By RavinderSingh13
Hello, Kindly use the following code for...
Hello,

Kindly use the following code for same.


awk -F"|" 'NR==FNR{a[$1]=$0;next} ($1 in a){b=$1;$1="";print a[b] $0}' OFS="|" file1 file2


Output will be as follows.

...
3,068
Posted By Akshay Hegde
Would this help you ? We can use following...
Would this help you ?

We can use following option available in date

%u day of week (1..7); 1 is Monday

%w day of week (0..6); 0 is Sunday
#!/bin/bash

today=$(date +"%Y%m%d")...
3,068
Posted By Blackacid
you want to run through a count starting from 0-9...
you want to run through a count starting from 0-9 (10), stepping back each iteration as a day in time. Then you want to identify any day that might be a Saturday or Sunday? I think this will work?...
2,637
Posted By RudiC
You'll need to fiddle around with some serious...
You'll need to fiddle around with some serious escaping, like (and eventually more)$ssh server_name 'for variable in $(ps -fu user | grep -i something/ | grep -i something | grep -v grep | awk...
2,637
Posted By MadeInGermany
If you have pgrep then you can probably do ...
If you have pgrep then you can probably do
pgrep -u user somethingand no problem to run that as ssh argument.
If you insist in your complex commands, save them in a script command.sh
And run it...
2,090
Posted By pamu
awk 'FNR==NR{A[NR]=$0;next}{print A[FNR]""$0}'...
awk 'FNR==NR{A[NR]=$0;next}{print A[FNR]""$0}' top_list.txt_temp_1 top_list.txt_temp
2,090
Posted By disedorgue
Hello, with command paste: paste -d'\0'...
Hello,

with command paste:
paste -d'\0' top_list.txt_temp_1 top_list.txt_temp

Regards.
3,339
Posted By RudiC
Try awk '. . . ; {for (i=12; i<=NF; i++) printf...
Try
awk '. . . ; {for (i=12; i<=NF; i++) printf "%s ", $i; printf "\n"}
3,339
Posted By Skrynesaver
See note on literal escape character in my...
See note on literal escape character in my original reply
3,339
Posted By MR.bean
bash-3.2$ cat input.txt ^[[7m PID USER PR...
bash-3.2$ cat input.txt
^[[7m PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND ^[[m^O^[[K...
3,339
Posted By krishmaths
Did you try the tr option to remove control...
Did you try the tr option to remove control characters?

tr -d [:cntrl:] <filename >output
10,663
Posted By Scott
Try escaping the inner double quotes: ......
Try escaping the inner double quotes:


... \"background-color:#FF9933\" ...

otherwise background-color:#FF9933 will be treated as awk code.
7,069
Posted By Corona688
This sort of conversation has made many...
This sort of conversation has made many head-level dents in my wall before. "I need array arrays!" "What are you doing?" "I need array arrays!" "But why do you need your data arranged that way? ...
7,069
Posted By RudiC
Why - do you think - did I put that eval into the...
Why - do you think - did I put that eval into the almost identical line 4 above your erroneous line? And, see and read again Corona688's post#8.
7,069
Posted By RudiC
Whilst I fully accord with Corona688 about better...
Whilst I fully accord with Corona688 about better not suboptimize but take the whole picture into account to find a good solution, here's a small bashism that might do what you're so eager for:while...
7,069
Posted By Corona688
I get from that: 1) You have huge files 2)...
I get from that:
1) You have huge files
2) You must output HTML
3) You'd like multidimensional arrays

This actually sounds like exactly the kind of situation awk is meant for. It has things...
7,069
Posted By Corona688
We get asked for this more often than you can...
We get asked for this more often than you can imagine, but to date nobody's ever given a better reason for it than "it seemed like a good idea at the time". It's always silly -- how would you even...
7,069
Posted By RudiC
This is a solution in bash, but you surely can...
This is a solution in bash, but you surely can devise a similar ksh thingy:while IFS=\| read -a WORD; do echo -e ${#WORD[@]} "\t" ${WORD[@]}; done < file
9 line1 111 22 33 44 55 aa bb cc
13 ...
7,069
Posted By Scrutinizer
To start read -a is bash syntax. The equivalent...
To start read -a is bash syntax. The equivalent ksh syntax is read -A
887
Posted By Scrutinizer
It should not be possible to calculate the...
It should not be possible to calculate the reverse. One could use tables, but not calculate the reverse. Even if a md5 happened to be in a table somewhere, there is not guarantee that it would be the...
13,654
Posted By DGPickett
A log file with one line per background process...
A log file with one line per background process is nice, as you can grep or count the tightly structured records.
But file per process in the background in a dedicated directory is the most...
13,654
Posted By DGPickett
Some systems even have pgrep, but if the running...
Some systems even have pgrep, but if the running background task subshell leaves a marker file, that is a cheaper test. Besides, pids get reused.
Showing results 1 to 25 of 30

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