Search Results

Search: Posts Made By: scriptor
10,951
Posted By RudiC
It's the same as $NF - the last field in the...
It's the same as $NF - the last field in the input line regardless of its actual field number.
awk splits the line into n fields and then assigns n to NF (number of fields?) If you have three...
1,068
Posted By Peasant
Hopefully it's correct :) { # On lines...
Hopefully it's correct :)


{
# On lines that meet condition -> if 'last' has a value and second field value of input is not equal to 'last'
if (last && $2 != last) {
# print variables...
1,068
Posted By MadeInGermany
This is the main loop that is run for each input...
This is the main loop that is run for each input record.
The variable "last" is tested for a value that was assigned in a previous loop cycle.
What happens in the first loop cycle? "last" is...
1,843
Posted By apmcd47
The file is /home/LOGS_2018-08-20.tar.gz and you...
The file is /home/LOGS_2018-08-20.tar.gz and you are looking for /home/LOGS_18-08-20.tar.gz. Change the %y in your script to %Y and try again.

Andrew
3,110
Posted By RudiC
Does it work without echoing the $DATE variable? ...
Does it work without echoing the $DATE variable?

Does it work when echoing the $DATE variable before the sftp command?
Forum: Programming 05-29-2018
1,584
Posted By Corona688
println() means "print line", it prints lines. ...
println() means "print line", it prints lines.

You could assemble the entire line you wanted to print before printing it.
1,930
Posted By MadeInGermany
A \n an embedded newline character (not two...
A \n an embedded newline character (not two consecutive characters \ and n).
sed loops over the lines in the input file, so the sed code only has one line in its "pattern space".
The \n character...
1,930
Posted By RudiC
. . . what does 1h - as said before, you have...
. . .
what does 1h - as said before, you have addresses and commands; here: on first line, copy pattern space to hold space. Multiple addresses possible. and 1! - ! means negation; some...
4,873
Posted By apmcd47
The bit in red. Rudi said the space was in d. ...
The bit in red. Rudi said the space was in d.
Try this instead:
d=`date "+%Y%m%d %H:%M"`

Andrew
8,432
Posted By apmcd47
In sed, and other tools such as grep and awk, []...
In sed, and other tools such as grep and awk, [] is a character class - a character that can match anything inside the brackets. This can be a list, a range, or a combination of the two. If the first...
1,818
Posted By RavinderSingh13
Hello scriptor, Could you please go through...
Hello scriptor,

Could you please go through the following explanation and let me know if this helps you.

awk -v Date=$(date +%d) -v Month=$(date +%m) -v Year=$(date +%Y) 'BEGIN{
#####creating...
6,808
Posted By RavinderSingh13
Hello scriptor, Could you please try...
Hello scriptor,

Could you please try following and let me know if this helps you.

cat script.ksh
DT1=`date --d "1 days ago" +%y"-"%m"-"%d`
echo $DT1
grep -i $DT1 Input_file
You could...
10,544
Posted By RudiC
You need to implement another authentication...
You need to implement another authentication method, e.g. "public key authentication". Check man ssh, chapter "AUTHENTICATION".
1,992
Posted By RudiC
man awk:gsub (/\|/, "\n" $1 ":") r: /\|/, a...
man awk:gsub (/\|/, "\n" $1 ":")
r: /\|/, a regex constant, value: | (needs to be escaped with \ as | has a special meeting in extended regex)
s: string consisting of three substrings:
"\n":...
2,410
Posted By RudiC
man awk: so, -vDT defines the variable DT to be...
man awk: so, -vDT defines the variable DT to be used inside the awk script.

And, ~ DT is not an option, but the matching operator; $0 ~ DT checks for a match.
2,410
Posted By MadeInGermany
The assignment is for awk - not a shell...
The assignment is for awk - not a shell assignment. Therefore needs quotes to prevent word splitting.
ls -l | awk -vDT="$(date +"%b %d")" '$0 ~ DT {print $9}'
Or use this precise one
ls -l | awk...
1,512
Posted By bakunin
The same way the OS figures to which the OS...
The same way the OS figures to which the OS figures out which file the link points to: it is stated in the command you use when creating the link. Suppose you create the link:

ln -s ./a ../b
...
1,512
Posted By Scrutinizer
1. $pwd/linkk 2. ln -s...
1. $pwd/linkk
2. ln -s /home/guest/khare/AWK/linkk /home/guest/khare/AWK/done
2,281
Posted By hicksd8
On RAID3 the parity drive is fixed. So, for...
On RAID3 the parity drive is fixed. So, for example, given the minimum of 3 drives, you get the usable capacity of 2 drives, and lose the capacity of 1 drive for parity. Similarly, if you had 50...
Forum: AIX 03-27-2014
1,221
Posted By zaxxon
From man errpt -s StartDate ...
From man errpt


-s StartDate
Specifies all records posted on and after the StartDate variable, where the StartDate variable has the format mmddhhmmyy (month, day, hour,...
1,435
Posted By vbe
well, e.g. lets take your last line: you cp...
well, e.g. lets take your last line:
you cp what?

cp -p $( ls -lrt | grep 'Mar 26' | awk '{print $9}') /home/guest/khare/debug

OK?
2,703
Posted By PikK45
@Scriptor: May be the script that you use could...
@Scriptor: May be the script that you use could tell you what it is...

search for the "not a regular file".. there could be a check like below

if [ -f FILE ]
854
Posted By RudiC
/ pattern start * ...
/ pattern start
* zero or more (= any number) spaces
\$ exactly the dollar sign
[1-9] one digit, excluding (leading) 0
[0-9]* zero or more...
5,930
Posted By RudiC
What did you expect after reading Don's and my...
What did you expect after reading Don's and my explanations (or - maybe - not?)? You have a space separated input and try to separate it by colons. The shell will of course use $x as one single lump...
5,600
Posted By Skrynesaver
There's no confusion, the two variables hold...
There's no confusion, the two variables hold different values that represent different things, however if you need a trick to tell them apart, PATH is the path to be searched for executables when you...
Showing results 1 to 25 of 26

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