Sponsored Content
Top Forums Shell Programming and Scripting Script to match lines in screen Post 302937593 by GhostMan on Friday 6th of March 2015 11:39:54 AM
Old 03-06-2015
Script to match lines in screen

I'd like to ask people who knows bash scripting to write me a script which would open a specific screen and match lines.

Here is algorithm I'm thinking about.
  1. Find SCREENS named name1, name2.... and nameX.
  2. Open them one by one and type 'STATS'
  3. Match last lines of the screen before command type and after.
  4. If lines don't match - move on to the next screen, if they do close current screen and run gaming server start line (I'll write this myself).

Note: Lines matching should be performed few times with few mins delays.

So the context of my problem is that I have few Counter-Strike gaming servers. Sometimes they crash and I have manually restart them. I'd like this to change.

I'm using Debian 6.0 32bit.

Last edited by rbatte1; 03-06-2015 at 01:43 PM.. Reason: Added LIST=1 tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to compare lines of two files and print output on screen

hey guys, I have two files both with two columns, I have already created an awk code to ignore certain lines (e.g lines that start with 963) as they wou ld begin with a certain string, however, the rest I have added together and calculated the average. At the moment the code also displays... (3 Replies)
Discussion started by: chlfc
3 Replies

2. Shell Programming and Scripting

Perl script to match a pattern and print lines

Hi I have a file (say 'file1')and I want to search for a first occurence of pattern (say 'ERROR') and print ten lines in the file below pattern. I have to code it in PERL and I am using Solaris 5.9. I appreciate any help with code Thanks Ammu (6 Replies)
Discussion started by: ammu
6 Replies

3. Shell Programming and Scripting

sed problem - delete all lines until a match on 2 lines

First of all, I know this can be more eassily done with perl or other scripting languages but, that's not the issue. I need this in sed. (or wander if it's possible ) I got a file (trace file to recreate the control file from oracle for the dba boys) which contains some lines another line... (11 Replies)
Discussion started by: plelie2
11 Replies

4. UNIX for Dummies Questions & Answers

Extracting m lines after n lines after match

Hi All, I would like to extract from a text file m lines skipping n lines after a string occurrency. Is it possible with grep? e.g. qqq ww eee rrr ttt yyy uuu I want to print 2 lines skipping 1 line after the string 'ww' result would be rrr ttt (2 Replies)
Discussion started by: f_o_555
2 Replies

5. Shell Programming and Scripting

shell script: grep multiple lines after pattern match

I have sql file containing lot of queries on different database table. I have to filter specific table queries. Let say i need all queries of test1,test2,test3 along with four lines above it and sql queries can be multi lines or in single line. Input file contains. set INSERT_ID=1; set... (1 Reply)
Discussion started by: mirfan
1 Replies

6. UNIX for Dummies Questions & Answers

awk display the match and 2 lines after the match is found.

Hello, can someone help me how to find a word and 2 lines after it and then send the output to another file. For example, here is myfile1.txt. I want to search for "Error" and 2 lines below it and send it to myfile2.txt I tried with grep -A but it's not supported on my system. I tried with awk,... (4 Replies)
Discussion started by: eurouno
4 Replies

7. Shell Programming and Scripting

Script to match strings that sometimes are splitted in 2 lines

Hello to all, I have an hexdump -C format as below: 31 54 47 55 48 4c 52 31 5f 52 31 32 31 31 32 ff 44 00 00 0E 01 32 14 56 42 17 47 48 0f ff ff ff 44 00 00 01 32 14 56 00 23 83 95 2f 42 17 47 48 00 0f ff ff 00 15 00 0a 48 00 01 5a 00 02 17 00 00 2f 00 00 30 00 00 31 00 00 ff 34 ff 44 00... (23 Replies)
Discussion started by: Ophiuchus
23 Replies

8. UNIX for Dummies Questions & Answers

awk - (URGENT!) Print lines sort and move lines if match found

URGENT HELP IS NEEDED!! I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but - Currently, script is not printing lines to File3.txt in order. - Also the matching lines are not moving out of File1.txt ... (1 Reply)
Discussion started by: High-T
1 Replies

9. Shell Programming and Scripting

Match the value & print lines from the match

Hello, I have a file contains two columns. I need to print the lines after “xxx” so i'm trying to match "xxx" & cut the lines after that. I'm trying with the grep & cut command, if there any simple way to extract this please help me. Sample file : name id AAA 123 AAB 124 AAC 125... (4 Replies)
Discussion started by: Shenbaga.d
4 Replies

10. Shell Programming and Scripting

awk to combine lines if fields match in lines

In the awk below, what I am attempting to do is check each line in the tab-delimeted input, which has ~20 lines in it, for a keyword SVTYPE=Fusion. If the keyword is found I am splitting $3 using the . (dot) and reading the portion before and after the dot in an array a. If it does have that... (12 Replies)
Discussion started by: cmccabe
12 Replies
LINK(2) 						      BSD System Calls Manual							   LINK(2)

NAME
link -- make a hard file link LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <unistd.h> int link(const char *name1, const char *name2); int linkat(int fd1, const char *name1, int fd2, const char *name2, int flags); DESCRIPTION
The link() function call atomically creates the specified directory entry (hard link) name2 with the attributes of the underlying object pointed at by name1. If the link is successful: the link count of the underlying object is incremented; name1 and name2 share equal access and rights to the underlying object. If name1 is removed, the file name2 is not deleted and the link count of the underlying object is decremented. name1 must exist for the hard link to succeed and both name1 and name2 must be in the same file system. name1 may not be a directory unless the caller is the super-user and the file system containing it supports linking to directories. When operating on a symlink, link() resolves the symlink and creates a hard link on the target. linkat() will do the same if AT_SYMLINK_FOLLOW is set in flags, but it will link on the symlink itself if the flag is clear. At the moment, linkat() is partially implemented. It will return ENOSYS for fd1 and fd2 values different than AT_FDCWD. RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS
link() will fail and no link will be created if: [EACCES] A component of either path prefix denies search permission, or the requested link requires writing in a directory with a mode that denies write permission. [EDQUOT] The directory in which the entry for the new link is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted. [EEXIST] The link named by name2 does exist. [EFAULT] One of the pathnames specified is outside the process's allocated address space. [EIO] An I/O error occurred while reading from or writing to the file system to make the directory entry. [ELOOP] Too many symbolic links were encountered in translating one of the pathnames. [EMLINK] The link count of the file named by name1 would exceed {LINK_MAX}. [ENAMETOOLONG] A component of a pathname exceeded {NAME_MAX} characters, or an entire path name exceeded {PATH_MAX} characters. [ENOENT] A component of either path prefix does not exist, or the file named by name1 does not exist. [ENOSPC] The directory in which the entry for the new link is being placed cannot be extended because there is no space left on the file system containing the directory. [ENOTDIR] A component of either path prefix is not a directory. [EOPNOTSUPP] The file system containing the file named by name1 does not support links. [EPERM] The file named by name1 is a directory and the effective user ID is not super-user, or the file system containing the file does not permit the use of link() on a directory. [EROFS] The requested link requires writing in a directory on a read-only file system. [EXDEV] The link named by name2 and the file named by name1 are on different file systems. SEE ALSO
symlink(2), unlink(2) STANDARDS
The link() function conforms to ISO/IEC 9945-1:1990 (``POSIX.1''). BUGS
linkat() is partially implemented. BSD
January 12, 1994 BSD
All times are GMT -4. The time now is 12:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy