Sponsored Content
Top Forums UNIX for Dummies Questions & Answers What is the command to add heading to a file? Post 88877 by flyingpenguin on Wednesday 9th of November 2005 02:42:31 PM
Old 11-09-2005
I don't know a specific command, but this one liner works fine in sh, bash, and tcsh (a bunch of other shells too):

Code:
( echo "Line to add" ; cat targetfile ) > tempfile ; cat tempfile > targetfile ; rm -f tempfile

Where targetfile is the file you're trying to add one line to.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SQL sorrting issue, and unwanted blank line above heading

Hi, I am running a shell script on Compaq Tru64 UNIX V5.1A. I have attached the shill script with the sql script it is calling to extract some data(hyp_dta_Extr.sql), and the results. I need the file to be tab delimited. (please note that I have renamed hyp_dta_Extr.sql to hyp_dta_Extr.txt to... (1 Reply)
Discussion started by: dazz
1 Replies

2. UNIX for Dummies Questions & Answers

Extract columns from multiple files with a file name as heading

Hi All, I have 7 files, each containing 9 columns separated by space. I want to extract the 9th columns from every file and save in a new file. The columns must be pasted next to each other. And the title of each columns should be the name of the corresponding files! Since the 3rd column is... (1 Reply)
Discussion started by: Unilearn
1 Replies

3. Shell Programming and Scripting

Sqlplus Set Heading not Working

Hello, Could someone tell me why this still returns headings? echo "SELECT columnA from tableA group by columnA;" | sqlplus -s ${DB_CONNECT} set heading OFF | while read line do arr="$line" echo ${arr} let i=$i+1 done (2 Replies)
Discussion started by: flowervz
2 Replies

4. Shell Programming and Scripting

Script to get the heading in files along with data

Hi everyone, I have a file which has data with different heading and column names as below. Static Data Ingested ,,,,,,,,,,,,Known Explained Rejections Column_1,column_2,Column_3,Column_4,,Column_6,Column_7,,% Column_8,,Column_9 ,Column_10... (1 Reply)
Discussion started by: Vivekit82
1 Replies

5. UNIX for Dummies Questions & Answers

Replacing "." with "GG" in a certain column of a file that has heading

Hi, all, I have a file that looks like: ## XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ## YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY #AA AB AC AD AE AF AG AH AI AJ AK AL 20 60039 60039 ... (5 Replies)
Discussion started by: kush
5 Replies

6. UNIX for Dummies Questions & Answers

Using awk to get folder name and date fields with heading

It is on the HP-Unix Output desired: Folder Name Date Folder1 Mar 18 10:00 Folder2 Mar 17 12:23 Tried with ls -ldt wp411* | awk '{print $9,"\t",$6," ",$7," "$8}' Please help me with the headings (3 Replies)
Discussion started by: Siva SQL
3 Replies

7. Shell Programming and Scripting

SQL Column Heading

Hi, I am selecting few columns from a table using select query in UNIX shell script ans sending the results as E-mail. But the column headings are not displayed fully. Instead it displays only a part of the heading. Please help as how to display it fully. Thanks in advance for your help. (7 Replies)
Discussion started by: pvelmuru
7 Replies

8. Shell Programming and Scripting

Need heading in files

Hi All, The below code is splitting the file "data.csv" into several files based on the"client_code" column. date_yyyymmdd=$(my_date "" -e"%Y%m%d") file_format="_$date_yyyymmdd.csv awk '{print $2, $3> DIR"/clients_" $1 file_out}' FS=' *; *' OFS=";" DIR="$TEMPL" file_out="_$file_format"... (3 Replies)
Discussion started by: ROCK_PLSQL
3 Replies

9. Programming

Joining Columnar heading from 2 lines

Hi, Below is the format of a report generated by a custom reporting solution. I opened the report in Notepad++ and junked data and values as in the image below. https://www.unix.com/attachment.php?attachmentid=7907&stc=1&d=1575507708 I want to convert the values to a PIPE delimited format as... (2 Replies)
Discussion started by: ramkrix
2 Replies
Test::TempDir(3pm)					User Contributed Perl Documentation					Test::TempDir(3pm)

NAME
Test::TempDir - Temporary files support for testing. SYNOPSIS
use Test::TempDir; my $test_tempdir = temp_root(); my ( $fh, $file ) = tempfile(); my $directory_scratch_obj = scratch(); DESCRIPTION
Test::TempDir provides temporary directory creation with testing in mind. The differences between using this and using File::Temp are: o If "t/tmp" is available (writable, creatable, etc) it's preferred over $ENV{TMPDIR} etc. Otherwise a temporary directory will be used. This is "temp_root" o Lockfiles are used on "t/tmp", to prevent race conditions when running under a parallel test harness. o The "temp_root" is cleaned at the end of a test run, but not if tests failed. o "temp_root" is emptied at the begining of a test run unconditionally. o The default policy is not to clean the individual "tempfiles" and "tempdirs" within "temp_root", in order to aid in debugging of failed tests. EXPORTS
temp_root The root of the temporary stuff. tempfile tempdir Wrappers for the File::Temp functions of the same name. The default options are changed to use "temp_root" for "DIR" and disable "CLEANUP", but these are overridable. scrach Loads Directory::Scratch and instantiates a new one, with the same default options as "tempfile" and "tempdir". SEE ALSO
File::Temp, Directory::Scratch, Path::Class VERSION CONTROL
This module is maintained using Git. You can get the latest version from <git://github.com/nothingmuch/test-tempdir.git>. AUTHOR
Yuval Kogman <nothingmuch@woobling.org> COPYRIGHT
Copyright (c) 2008 Yuval Kogman. All rights reserved This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.0 2009-08-11 Test::TempDir(3pm)
All times are GMT -4. The time now is 02:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy