Search Results

Search: Posts Made By: chidori
4,889
Posted By Yoda
Here is one way of doing it: awk ' ...
Here is one way of doing it:
awk '
/^[ ]*\/\*/ {
if ( NR > 1 && !(f) )
print "No_Condition"
f = 0
printf ( "%s =...
12,333
Posted By rajamadhavan
-n option to ssh will avoid this. while...
-n option to ssh will avoid this.


while read a b
do
ssh -qn $a uname -a
done < inputfile
2,549
Posted By Corona688
You can overwrite the same line every time by...
You can overwrite the same line every time by printing a carriage return instead of a newline, the cursor will return to the beginning of the line but not travel down to the next line.

Note this...
2,549
Posted By RudiC
Not sure what you want to achieve; if you want to...
Not sure what you want to achieve; if you want to output to a single line only, try adding a <carriage return> character:$ for i in {1..10}; do echo -en "\rCurrent Record = $i"; sleep 1; done
2,760
Posted By Scrutinizer
Try: ..);$1=$1;print In the first two lines...
Try: ..);$1=$1;print

In the first two lines there are no commas in the last field, so no substitution takes place and the field does not get modified and therefore the record does not get...
32,437
Posted By Don Cragun
Since India does not waste time with daylight...
Since India does not waste time with daylight saving time shifts, just setting TZ=IST-5:30 will give you the correct time in India at any time of year. For example, a few seconds ago:
TZ=GMT0...
3,819
Posted By Don Cragun
Despite what DGPickett said, perl had no affect...
Despite what DGPickett said, perl had no affect on the description of regular expression in the POSIX standards.

There are several variations on RE processing, but there are three main types...
3,819
Posted By DGPickett
Some flavors of regex have + for one or more, but...
Some flavors of regex have + for one or more, but you can just say 'ee*'. Also, there is '\{1,99\}' for 1 to 99 in the sed flavor. There must be about a dozen regex flavors, especially after the PERL...
2,550
Posted By Scrutinizer
awk 'NR>x+y{print A[NR%y]} {A[NR%y]=$0}' x=6 y=2...
awk 'NR>x+y{print A[NR%y]} {A[NR%y]=$0}' x=6 y=2 infile
9,685
Posted By Don Cragun
In addition to the possibilities already listed,...
In addition to the possibilities already listed, note that the standards only define the behavior of sed when the input is a text file. The output from the tr command is not a text file (by...
9,685
Posted By Scott
Based exactly on your input file, it works for...
Based exactly on your input file, it works for me. What is not working about it for you?


$ tr -s '\n' ',' < file | sed 's/,$//'
alpha,beta,gamma

(no need for cat, though)

You can also...
5,338
Posted By binlib
$value=(split(/:/,$req_user_info))[3];
$value=(split(/:/,$req_user_info))[3];
5,338
Posted By guruprasadpr
Hi You should use it like this: my...
Hi
You should use it like this:

my ($req_user_info)=grep(/$x/,@input);

This is because grep returns a list, and when used in scalar context, you get the length.

Guru.
5,047
Posted By Scrutinizer
Yes, && FNR>1 keeps the value on the first line...
Yes, && FNR>1 keeps the value on the first line of the file from being printed. You can leave that out if the actual file does not contain a header...
Forum: Red Hat 08-16-2012
9,590
Posted By Corona688
It's trying to ask for a password and can't,...
It's trying to ask for a password and can't, since you have no terminal. The way to fix that is to remove the password requirement for that sudo entry, not remove the TTY requirement.

Be very...
11,337
Posted By methyl
From a syntax point of view, it should be...
From a syntax point of view, it should be something like this:

30 17 8-14 * * [ `date +\%u` -eq 6 ] && /rebootscript # to reboot every second saturday
30 17 22-28 * * [ `date +\%u` -eq 6 ] &&...
3,690
Posted By Scrutinizer
Try: /usr/xpg4/bin/grep -E '^May 29...
Try:
/usr/xpg4/bin/grep -E '^May 29 15:([01]|2[0-3])' /var/adm/messages
3,690
Posted By ygemici
try this ;) /usr/xpg4/bin/grep -E 'May 29...
try this ;)
/usr/xpg4/bin/grep -E 'May 29 15:([01][0-9]|[2][0-3]):[0-9]'
3,690
Posted By elixir_sinari
Try with /usr/xpg4/bin/egrep
Try with

/usr/xpg4/bin/egrep
5,068
Posted By elixir_sinari
Did you try mine with that input? It will work. ...
Did you try mine with that input? It will work.

---------- Post updated at 07:26 AM ---------- Previous update was at 07:20 AM ----------

/^uid=[0-9]*(\([^)]*\)).*groups=.*(macusr).*/

is...
1,210
Posted By neutronscott
firstly you match pattern and print that line....
firstly you match pattern and print that line. you set a counter to 6, so then each line after you evaluate c-- (decrease by 1) and then test if it's above 0. using the semicolon here you omit the...
1,210
Posted By rangarasan
awk
Hi,

Try this one,


nawk 'BEGIN{FS="=";}/Server.Host/{sub ($2,"test.sol.box");}1' test.txt


Here 1 in the end of the block will display all the lines.

FS must be specified in BEGIN...
6,116
Posted By itkamaraj
$ cat -n a.txt 1 one 2 two ...
$ cat -n a.txt
1 one
2 two
3 three
4 four
5 five
6 six
7 seven
8 eight
9 nine
10 ten
11 eleven
$ awk...
7,438
Posted By methyl
Wonder what you mean by "their info"? If...
Wonder what you mean by "their info"?

If it's just the login name:
logins -g tiadm | awk '{print $1}'If it's everything available and in a machine-readable format:
logins -xtog tiadm
7,438
Posted By Scrutinizer
One awk: awk -F: 'NR==FNR &&...
One awk:
awk -F: 'NR==FNR && $1==g{split($4,T,","); for(i in T) U[T[i]]; next} $1 in U' g=tiadm /etc/group /etc/passwd
Showing results 1 to 25 of 51

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