Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to check if there is only one row in the file? Post 302459949 by DGPickett on Tuesday 5th of October 2010 04:42:52 PM
Old 10-05-2010
While "wc -l <file" prints "1", you can save a fork and exec with this:

Code:
#!/usr/bin/ksh

exec <$1

read ln
read ln
if [ "$ln" != "" ]
then
 echo "longer...." | mail -s "subject" user@domain.com
fi

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Changing the column for a row in a text file and adding another row

Hi, I want to write a shell script which increments a particular column in a row from a text file and then adds another row below the current row with the incremented value . For Eg . if the input file has a row : abc xyz lmn 89 lm nk o p I would like the script to create something like... (9 Replies)
Discussion started by: aYankeeFan
9 Replies

2. Shell Programming and Scripting

Append Second Row to First Row @ end in a file

Hi I want to append line 2n to 2n-1 line where n=1...LastLine in my file. eg: Actual File: Hello Everyone Welcome TO Unix I need Your help Required File: HelloEveryone WelcomeTO Unix I needYour help (5 Replies)
Discussion started by: dashing201
5 Replies

3. Shell Programming and Scripting

Get a group of line from different file and put them into one file row by row

hi guys, today i'm stuck in a new problem. the title explain more or less but a particular had been omitted. So i'm going to describe below the situation with an example. I have different html files and each of them have a consecutive lines group inside that i want to extract. example: ... (8 Replies)
Discussion started by: sbobotex
8 Replies

4. Shell Programming and Scripting

awk to check begining of each row

Hi, I want to insert columns into a file. Some are standard (e.g. 1) and some are dependent on the contents on other columns. I am using the following code In the below the first 1 (after $2), can be a 1 or 3 depending on what $1 starts with e.g. if $1 is 405 then the third field in the... (7 Replies)
Discussion started by: ksexton
7 Replies

5. Shell Programming and Scripting

Adjacent row and column check in Perl

HI, i am new to perl world. And i am trying to compress a file, as given below procedure. INPUT FILE: 1 1 2 1 ==> R1 2 1 3 1 ==> R2 3 1 4 1 ==> R3 OUTPUT FILE: 1 1 4 1 (3 Replies)
Discussion started by: vasanth.vadalur
3 Replies

6. Shell Programming and Scripting

Subtracting each row from the first row in a single column file using awk

Hi Friends, I have a single column data like below. 1 2 3 4 5 I need the output like below. 0 1 2 3 4 where each row (including first row) subtracting from first row and the result should print below like the way shown in output file. Thanks Sid (11 Replies)
Discussion started by: ks_reddy
11 Replies

7. Shell Programming and Scripting

Request to check:remove entries with duplicate numbers in first row

Hi I have a file 1 xyz 456 1 xyz 456 1 xyz 456 2 abc 8459 3 gfd 657 4 ghf 658 4 ghf 658 I want the output 1 xyz 456 2 abc 8459 3 gfd 657 4 ghf 658 (3 Replies)
Discussion started by: manigrover
3 Replies

8. Shell Programming and Scripting

Parse tab delimited file, check condition and delete row

I am fairly new to programming and trying to resolve this problem. I have the file like this. CHROM POS REF ALT 10_sample.bam 11_sample.bam 12_sample.bam 13_sample.bam 14_sample.bam 15_sample.bam 16_sample.bam tg93 77 T C T T T T T tg93 79 ... (4 Replies)
Discussion started by: empyrean
4 Replies

9. Shell Programming and Scripting

Read row number from 1 file and print that row of second file

Hi. How can I read row number from one file and print that corresponding record present at that row in another file. eg file1 1 3 5 7 9 file2 11111 22222 33333 44444 55555 66666 77777 88888 99999 (3 Replies)
Discussion started by: Abhiraj Singh
3 Replies

10. Shell Programming and Scripting

Search row by row from one file to another file if match is found print few colums of file 2

this is the requirement list.txt table1 table2 table3 testfile.txt name#place#data#select * from table1 name2#place2#data2#select * from table 10 innerjoin table3 name2#place2#data2#select * from table 10 output name place table1 name2 place table3 i tried using awk (7 Replies)
Discussion started by: vamsekumar
7 Replies
GET_ROBUST_LIST(2)						Linux System Calls						GET_ROBUST_LIST(2)

NAME
get_robust_list, set_robust_list - get/set list of robust futexes SYNOPSIS
#include <linux/futex.h> #include <sys/types.h> #include <syscall.h> long get_robust_list(int pid, struct robust_list_head **head_ptr, size_t *len_ptr); long set_robust_list(struct robust_list_head *head, size_t len); Note: There are no glibc wrappers for these system calls; see NOTES. DESCRIPTION
These system calls deal with per-thread robust futex lists. These lists are managed in user space: the kernel knows only about the loca- tion of the head of the list. A thread can inform the kernel of the location of its robust futex list using set_robust_list(). The address of a thread's robust futex list can be obtained using get_robust_list(). The purpose of the robust futex list is to ensure that if a thread accidentally fails to unlock a futex before terminating or calling execve(2), another thread that is waiting on that futex is notified that the former owner of the futex has died. This notification con- sists of two pieces: the FUTEX_OWNER_DIED bit is set in the futex word, and the kernel performs a futex(2) FUTEX_WAKE operation on one of the threads waiting on the futex. The get_robust_list() system call returns the head of the robust futex list of the thread whose thread ID is specified in pid. If pid is 0, the head of the list for the calling thread is returned. The list head is stored in the location pointed to by head_ptr. The size of the object pointed to by **head_ptr is stored in len_ptr. Permission to employ get_robust_list() is governed by a ptrace access mode PTRACE_MODE_READ_REALCREDS check; see ptrace(2). The set_robust_list() system call requests the kernel to record the head of the list of robust futexes owned by the calling thread. The head argument is the list head to record. The len argument should be sizeof(*head). RETURN VALUE
The set_robust_list() and get_robust_list() system calls return zero when the operation is successful, an error code otherwise. ERRORS
The set_robust_list() system call can fail with the following error: EINVAL len does not equal sizeof(struct robust_list_head). The get_robust_list() system call can fail with the following errors: EPERM The calling process does not have permission to see the robust futex list of the thread with the thread ID pid, and does not have the CAP_SYS_PTRACE capability. ESRCH No thread with the thread ID pid could be found. EFAULT The head of the robust futex list can't be stored at the location head. VERSIONS
These system calls were added in Linux 2.6.17. NOTES
These system calls are not needed by normal applications. No support for them is provided in glibc. In the unlikely event that you want to call them directly, use syscall(2). A thread can have only one robust futex list; therefore applications that wish to use this functionality should use the robust mutexes pro- vided by glibc. In the initial implementation, a thread waiting on a futex was notified that the owner had died only if the owner terminated. Starting with Linux 2.6.28, notification was extended to include the case where the owner performs an execve(2). The thread IDs mentioned in the main text are kernel thread IDs of the kind returned by clone(2) and gettid(2). SEE ALSO
futex(2), pthread_mutexattr_setrobust(3) Documentation/robust-futexes.txt and Documentation/robust-futex-ABI.txt in the Linux kernel source tree 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/. Linux 2017-09-15 GET_ROBUST_LIST(2)
All times are GMT -4. The time now is 08:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy