Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to append a string by cat and redirect to other file? Post 302941540 by RudiC on Friday 17th of April 2015 04:59:01 AM
Old 04-17-2015
Don't pipe the echo, connect the two by either ANDing them:
Code:
echo -n "kernel.sem =  " && cat /proc/sys/kernel/sem

or a group command (compound command):
Code:
{ echo -n "kernel.sem =  "; cat /proc/sys/kernel/sem; }

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Append and redirect

Can somebody please explain to me what redirection (>) and append are? What is the difference between > and >>? Thank-you (1 Reply)
Discussion started by: Anna
1 Replies

2. Shell Programming and Scripting

variable= 'cat file|wc -l' String problems

Hi, does anybody knows about wc -l, how to transform it inot a just number? this script ALWAYS executes the command3!!, However, the value of BMU_RUNNING is 1 case $BMU_RUNNING in *0) command1 ;; *1) command 2;; *)command 3;; esac The... (3 Replies)
Discussion started by: Santiago
3 Replies

3. UNIX for Dummies Questions & Answers

How to redirect date with string command into txt file

Hello im trying to redirect the standard output into txt file but with combination of string if I do : date >! foo.txt there is no problem and im getting the date into the foo.txt but what should I do if I like to add string in the same command so the result will be in the txt : The date... (2 Replies)
Discussion started by: umen
2 Replies

4. Shell Programming and Scripting

Append (cat) to beginning of file ?

Hi, Fairly new to unix scripting, hoping to get some help. using AIX v5 Basically I have 3 files 1). Header record 2). many detail record 3). Trailer record My desired result is 1 file which contains Heaeder, Detail, Trailer Currenty I am using a series of: ... (8 Replies)
Discussion started by: CBZ
8 Replies

5. Shell Programming and Scripting

redirect cat to variable

hello just i saw a really strange for cat i have file (file1) contains line /home/rajiv/proj1/*.txt now applied a commonds DDPATH="$(cat file1)" echo $DDPATH it shows all the txt files in that folder like /home/rajiv/proj1/read1.txt /home/rajiv/proj1/read2.txt... (7 Replies)
Discussion started by: shailesh_arya
7 Replies

6. UNIX for Dummies Questions & Answers

How can i append a file name with a string

Hi All How can i append a file name with a string e.g. Lets say i have a file called ABC_TEST_1234_1.dat and i want to append the file name with a lets say 100 so the output file should look like ABC_100_TEST_1234_1.dat i have aroung 9000 file in a directory and want to... (3 Replies)
Discussion started by: Nikhilindurkar
3 Replies

7. Shell Programming and Scripting

cat redirect EOF missing text

Hello attempting to redirect out to create a startup script in solaris. The steps are working but the $1 entry is being left out. syntax below and content of output file below. cat > S99build << EOF > #!/bin/bash > case $1 in > 'start') > /usr/os-buildsol.sh > > ;; > esac > exit 0 >... (3 Replies)
Discussion started by: juanb25
3 Replies

8. Shell Programming and Scripting

Find string in file and append new string after

Hi All, I'm trying to insert a string into a file at a specific location. I'd like to add a string after the parent::__construct(); in my file. <?php if (! defined('BASEPATH')) exit('No direct script access allowed'); class MY_Controller extends CI_Controller { function... (6 Replies)
Discussion started by: jjkilpatrick
6 Replies

9. Shell Programming and Scripting

Redirect the output of the file based on String

Hi, I need to redirect the output of the file until the first instance of a string is found. So in the filename output.txt i was to redirect everything from the start to where i find this string "BEA-000377" is found to a new file called output_new.txt Sample output.txt the controller... (1 Reply)
Discussion started by: mohtashims
1 Replies

10. Shell Programming and Scripting

Cat files listed in text file and redirect to new directory with same filename

I have a directory that is restricted and I cannot just copy the files need, but I can cat them and redirect them to a new directory. The files all have the date listed in them. If I perform a long listing and grep for the date (150620) I can redirect that output to a text file. Now I need to... (5 Replies)
Discussion started by: trigger467
5 Replies
SEM_DESTROY(3)						   BSD Library Functions Manual 					    SEM_DESTROY(3)

NAME
sem_destroy -- destroy an unnamed semaphore LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <semaphore.h> int sem_destroy(sem_t *sem); DESCRIPTION
The sem_destroy() function destroys the unnamed semaphore pointed to by sem. After a successful call to sem_destroy(), sem is unusable until re-initialized by another call to sem_init(3). RETURN VALUES
The sem_destroy() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS
The sem_destroy() function will fail if: [EINVAL] The sem argument points to an invalid semaphore. [EBUSY] There are currently threads blocked on the semaphore that sem points to. SEE ALSO
sem_init(3) STANDARDS
The sem_destroy() function conforms to ISO/IEC 9945-1:1996 (``POSIX.1''). POSIX does not define the behavior of sem_destroy() if called while there are threads blocked on sem, but this implementation is guaranteed to return -1 and set errno to EBUSY if there are threads blocked on sem. BSD
February 15, 2000 BSD
All times are GMT -4. The time now is 05:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy