Concatenate a string and number and compare that with another string in awk script
I have below code inside my awk script
Moderator's Comments:
Please use code tags
The issue here is it works fine when both in and out values are strings and gets an error when one of them is a number.
My input file has diff combinations, how can we convert it when we get a number in any one value?
Last edited by jim mcnamara; 08-27-2019 at 08:10 PM..
I want to concatenate any particular field of the file with any String say SSB....but i am not able to do it...
I hv tried the following code....but its saying there is error in parsing it..
awk 'BEGIN { FS = "," ; OFS = "," ; } { for ( i = 1 ; i < 5 ; i++ ) {a=i;b="SSB"; print $1,$a$b,$3 } }'... (3 Replies)
Hi,
I have a program written in awk and I want to extend it to do another task.
My program is a list of CVS log reports of a repository. For each file, I have some fields. One of the fields is the comment field. I want to know how I can check if a comment (which is a free text field)... (8 Replies)
I have the following simplified code that I am planning on putting into a larger shell script. I have been butchering it to try and make work amongst google searches and reading awk documentation.
amixer sset Master toggle | awk '{ if ( /^ Front Left/ { print $7 } == // ) print "MUTED" }'I... (2 Replies)
In Bash using AWK or sed I need to convert the following file:
...
numitem_tab0 =<p>1 KEYWORD</p><p>2 KEYWORD</p><p>3 KEYWORD</p><p>4 KEYWORD</p><p>5 KEYWORD</p>...<p>25 KEYWORD</p>
subitem_tab0 =<p></p><p></p>
...
numitem_tab6 =<p>1 KEYWORD</p><p>2 KEYWORD</p><p>3 KEYWORD</p><p>4 KEYWORD</p>... (2 Replies)
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
I have a file that looks like this:
John Smith
http://www.profile1.com
http://www.profile2.com
http://www.profile3.com
Marc Olsen
http://www.profile4.com
http://www.profile5.com
http://www.profile6.com
http://www.profile7.com
Lynne Doe
http://www.profile8.com
http://www.profile9.com... (3 Replies)
Need help for awk..
file will have comma separated numbers, I need check digits before 10 numbers eg ( 001)1234567890
Basically want to check country code of a mobile number.
eg:
abc,def,data, data,0011234567890, data,data
Script should be checking country code with 001, I will pass... (10 Replies)
Hi all,
I was doing some string manipulation in my script and wanted to try using awk. However, I have been stuck with string compare. A simplified form of my conundrum is given below:
The below prints expected result (prints "Completed because that is the second element"):
$ echo... (5 Replies)
Hi All,
I have a file test.txt.
Content of test.txt :
1 vinay se
2 kumar sse
4 kishore tl
I am extracting the content of file with below command.
awk '$2 ~ "vinay" {print $0}' test.txt
Now instead of hardcoding $2 is there any way pass $2 as variable and compare with a... (7 Replies)
Hi,
I want to compare strings length to a number but i am getting error. I want first name should be length of 8.
Please help.
#bin !/bin/bash
clear
echo -n "Enter name "
read name
IFS=_
ary=($name)
for key in "${!ary}"; do echo "$key${ary}"; done
##First name should be equal to 8... (8 Replies)
Discussion started by: rajneesh4U
8 Replies
LEARN ABOUT REDHAT
mod-active
MOD-ACTIVE(8) System Manager's Manual MOD-ACTIVE(8)NAME
mod-active - batch processing of ctlinnd newgroup/rmgroup/changegroup
SYNOPSIS
mod-active [ ctlinnd_command_file ]
DESCRIPTION
mod-active is a perl script that updates the active file based on its input lines of ctlinnd newgroup, rmgroup and changegroup commands.
It pauses the server briefly while the existing active file is read and rewritten, which not only keeps innd from updating the active file
but also locks against other instances of mod-active.
The input to mod-active can come either from one or more files named on the command line, or from the standard input. Typically its input
is the output from the docheckgroups or actsync commands. Every line which contains the string "ctlinnd newgroup", "ctlinnd rmgroup" or
"ctlinnd changegroup", optionally preceded by whitespace and/or the path to ctlinnd, is noted for the update. Redundant commands, such as
a newgroup directive for a group that already exists, are silently ignored. All other lines in the input are also silently ignored.
After the new active file has been generated, the existing one is renamed to active.old and the new one is moved into place. The script
then displays the differences between the two files.
Any groups that were added to the active file are also added to the active.times file with the string "checkgroups-update".
BUGS
Though innd is paused while mod-active works, it is not inconceivable that there could be a conflict if something else tries to update the
active file during the relatively short time that mod-active is working. The two most realistic ways I can think of for this to happen are
either by an administrator concurrently doing a manual ctlinnd command, or by innd receiving a control message, then mod-active pausing the
server, then the control message handler script that innd forked running its own ctlinnd command while mod-active is working. I've been
using mod-active regularly for several years, though, and never had either problem.
HISTORY
Written by David C Lawrence <tale@isc.org>.
SEE ALSO active(5), actsync(8), ctlinnd(8), innd(8).
MOD-ACTIVE(8)