Sponsored Content
Top Forums Shell Programming and Scripting Sed insert text at first line of empty file Post 302497749 by DC Slick on Friday 18th of February 2011 01:42:07 AM
Old 02-18-2011
What are my alternatives? Examples?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SED- Insert text at top of file

Does anyone know how to insert text at the top and bottom of a file using sed? (12 Replies)
Discussion started by: MBGPS
12 Replies

2. Shell Programming and Scripting

How to insert some constant text at beginig of each line within a text file.

Dear Folks :), I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp. I can do this in vi editor by using this command :g/^/s//BBB_ e,g I have a file named as Test.dat and it containins below text: michal... (4 Replies)
Discussion started by: Muhammad Afzal
4 Replies

3. Shell Programming and Scripting

Need to insert new text and change existing text in a file using SED

Hi all, I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output. sed '$a\ hi... ' shell > shell1 But I face problem when using the same in script. It is throwing the error as, sed: command garbled:... (4 Replies)
Discussion started by: iamgeethuj
4 Replies

4. Shell Programming and Scripting

sed insert text at particular line

I know that sed -n '12p' file will print line 12 but how might I insert text to a specified line? thanks (2 Replies)
Discussion started by: action_owl
2 Replies

5. Shell Programming and Scripting

Using sed to insert text file at first line

sed '1r file.txt' <source.txt >desti.txt This example will insert 'file.txt' between line 1 and 2 of source.txt. sed '0r file.txt' <source.txt >desti.txt gives an error message. Does anyone know how 'sed' can insert 'file.txt' before the first line of source.txt? (18 Replies)
Discussion started by: psve
18 Replies

6. Shell Programming and Scripting

Delete the last empty/blank line of the text file

Hi All, I have a file.txt which seems like having three lines. wc -l file.txt 3 file.txt In fact, once it is open in text editor, this file has four lines where the last line is empty. how can i delete this last empty line of the file.txt? I tried the codes below so far but they... (6 Replies)
Discussion started by: senayasma
6 Replies

7. Shell Programming and Scripting

insert text into empty file

I have an awk script to extract data from several files and create output in the following format as a csv file: xxxx 01/04/12 0001 0 When data is present, I have a file. When no data is available in the input files, I would still like to create a file that looks like this: xxxx... (1 Reply)
Discussion started by: banjo25
1 Replies

8. Shell Programming and Scripting

sed - insert text if column empty

Hi, I want to insert the text 'Unknown' in 2 specific columns in a csv file (actually | separated) if the column is blank. Its always the same columns. I have tried using sed: sed "s/||/|Unknown|/g" but there are occasion where other fields are blank and they need to be left blank. This... (4 Replies)
Discussion started by: ksexton
4 Replies

9. Shell Programming and Scripting

How to read a text file line by line and insert into a database table?

I have a test file that I want to read and insert only certain lines into the the table based on a filter. 1. Rread the log file 12 Hours back Getdate() -12 Hours 2. Extract the following information on for lines that say "DUMP is complete" A. Date B. Database Name C.... (2 Replies)
Discussion started by: JolietJake
2 Replies

10. UNIX for Beginners Questions & Answers

Insert a line of text on nth line of a file

Hi All, I am using UNix Sun OS sun4u sparc SUNW,SPARC-Enterprise My intention is to insert a line of text after 13th line of every file inside a particular directory. While trying to do it for a single file , i am using sed sed '3 i this is the 4th line' filename sed: command garbled: 3... (5 Replies)
Discussion started by: gotamp
5 Replies
LIBMTP_file_struct(3)						      libmtp						     LIBMTP_file_struct(3)

NAME
libmtp - LIBMTP_file_struct SYNOPSIS
#include <libmtp.h> Data Fields uint32_t item_id uint32_t parent_id uint32_t storage_id char * filename uint64_t filesize time_t modificationdate LIBMTP_filetype_t filetype LIBMTP_file_t * next Detailed Description MTP file struct Examples: delfile.c, detect.c, files.c, getfile.c, newfolder.c, sendfile.c, and sendtr.c. Field Documentation char* LIBMTP_file_struct::filename Filename of this file Examples: detect.c, and files.c. Referenced by LIBMTP_destroy_file_t(), LIBMTP_new_file_t(), LIBMTP_Send_Track_From_File_Descriptor(), LIBMTP_Send_Track_From_Handler(), and LIBMTP_Set_File_Name(). uint64_t LIBMTP_file_struct::filesize Size of file in bytes Examples: files.c. Referenced by LIBMTP_Send_File_From_File_Descriptor(), LIBMTP_Send_File_From_Handler(), LIBMTP_Send_Track_From_File_Descriptor(), and LIBMTP_Send_Track_From_Handler(). LIBMTP_filetype_t LIBMTP_file_struct::filetype Filetype used for the current file Examples: files.c. Referenced by LIBMTP_Send_Track_From_File_Descriptor(), LIBMTP_Send_Track_From_Handler(), LIBMTP_Set_File_Name(), and LIBMTP_Set_Object_Filename(). uint32_t LIBMTP_file_struct::item_id Unique item ID Examples: detect.c, and files.c. Referenced by LIBMTP_Send_File_From_File_Descriptor(), LIBMTP_Send_File_From_Handler(), LIBMTP_Send_Track_From_File_Descriptor(), LIBMTP_Send_Track_From_Handler(), and LIBMTP_Set_File_Name(). time_t LIBMTP_file_struct::modificationdate Date of last alteration of the file LIBMTP_file_t* LIBMTP_file_struct::next Next file in list or NULL if last file Examples: detect.c, and files.c. Referenced by LIBMTP_Get_Filelisting_With_Callback(), LIBMTP_Get_Files_And_Folders(), LIBMTP_Send_Track_From_File_Descriptor(), and LIBMTP_Send_Track_From_Handler(). uint32_t LIBMTP_file_struct::parent_id ID of parent folder Examples: files.c. Referenced by LIBMTP_Send_File_From_File_Descriptor(), LIBMTP_Send_File_From_Handler(), LIBMTP_Send_Track_From_File_Descriptor(), and LIBMTP_Send_Track_From_Handler(). uint32_t LIBMTP_file_struct::storage_id ID of storage holding this file Examples: files.c. Referenced by LIBMTP_Send_File_From_File_Descriptor(), LIBMTP_Send_File_From_Handler(), LIBMTP_Send_Track_From_File_Descriptor(), and LIBMTP_Send_Track_From_Handler(). Author Generated automatically by Doxygen for libmtp from the source code. Version 1.1.3 Sun Feb 17 2013 LIBMTP_file_struct(3)
All times are GMT -4. The time now is 02:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy