Being new to shell scripting I hope this question isn't too elementary but here goes.
I run a grep statement - grep 'sqr' sqrmodule.par and the grep statement returns correctly the information that I'm looking for. Now I want to take the output from the grep statement and load it into a... (2 Replies)
i have such awk working fine but how to use variable instead of strings
awk '/asdasd.*asda.*asdasd/' file2.txt
This is not working:
awk '/${a}.*${b}.*${c}/' file2.txt
Thanks & regards
Peter (7 Replies)
Hi,
I have a reqmt as i have some values in array and I want to search each value in a file by grep command.
Here goes my scripting:
#!/bin/ksh
set -A ArrayA CENTER LEFT RIGHT
echo "ArrayA contains: ${ArrayAİ*¨}"
grep -e "${ArrayAİ*¨}" filename.txt
The above grep is working for... (4 Replies)
Hi all,
I have a problem, I need a grep -v but, the patterns of the grep should be C variables.
Example:
char var1="h";
char var2="o";
char var3="d";
system("grep -v \"var1 var2 var3\" file.txt");
----
----
----
I try it but... Can u help me?
Thanks beforehand
P.S. Sorry for... (4 Replies)
Help,
I have a ksh script that has some variables within the grep command, I am then setting another variable that greps the variables that have greps within them.
cat $WORKINGDIR/meter_list.txt | while read meter
do
serialnum=$(cat masterlogfile.txt | grep "$meter" | awk '{ print $19 }'... (7 Replies)
Hello,
I want to only print lines where variables occur more than once using grep.
For eg:
Input:
$this is a comment
int a,b,c,b;
int b,c;
int d,e;
int f,g,f;
x=y+5;
For the above input, the output would be
int a,b,c,b;
int f,g,f;
I have done grep... (3 Replies)
Good day Geeks,
Am having an issue with using variables in a rather simple script, the script is as follows:
#!/bin/bash
### Script written by Adigun Gbenga
### Date: April 28, 2012
array=( 1 2 3 4 5 29 7 8 9... (6 Replies)
Hello, this will be my first post. I've been browsing around for a bit and have found a lot of useful information on here, hopefully a solution can be provided to me.
Issue:
Alright, I am looking to search for strings within a file using variables.
I have a script that will accept 3 or 4... (2 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
The issue I am having is part of a validation problem. My script will validate 3 or 4 parameters entered by the... (4 Replies)
Hi, I'm currently trying to use variables in grep on my script. Printing the variable via echo works fine. Also, if I hard coded the date of the appointment it works just fine. But, if I try to use the $DATE as an argument in grep it doesn't do anything.
#!/bin/bash
DATE=${2}/${3}/${1} ... (6 Replies)
Discussion started by: nuclearpenguin
6 Replies
LEARN ABOUT PLAN9
ftok
FTOK(3) Linux Programmer's Manual FTOK(3)NAME
ftok - convert a pathname and a project identifier to a System V IPC key
SYNOPSIS
#include <sys/types.h>
#include <sys/ipc.h>
key_t ftok(const char *pathname, int proj_id);
DESCRIPTION
The ftok() function uses the identity of the file named by the given pathname (which must refer to an existing, accessible file) and the
least significant 8 bits of proj_id (which must be nonzero) to generate a key_t type System V IPC key, suitable for use with msgget(2),
semget(2), or shmget(2).
The resulting value is the same for all pathnames that name the same file, when the same value of proj_id is used. The value returned
should be different when the (simultaneously existing) files or the project IDs differ.
RETURN VALUE
On success, the generated key_t value is returned. On failure -1 is returned, with errno indicating the error as for the stat(2) system
call.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
+----------+---------------+---------+
|Interface | Attribute | Value |
+----------+---------------+---------+
|ftok() | Thread safety | MT-Safe |
+----------+---------------+---------+
CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
NOTES
On some ancient systems, the prototype was:
key_t ftok(char *pathname, char proj_id);
Today, proj_id is an int, but still only 8 bits are used. Typical usage has an ASCII character proj_id, that is why the behavior is said
to be undefined when proj_id is zero.
Of course, no guarantee can be given that the resulting key_t is unique. Typically, a best-effort attempt combines the given proj_id byte,
the lower 16 bits of the inode number, and the lower 8 bits of the device number into a 32-bit result. Collisions may easily happen, for
example between files on /dev/hda1 and files on /dev/sda1.
SEE ALSO msgget(2), semget(2), shmget(2), stat(2), svipc(7)COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
GNU 2015-08-08 FTOK(3)