Sponsored Content
Top Forums Shell Programming and Scripting Checking and replacing first line in text file, one-liner? Post 303015317 by rdrtx1 on Monday 2nd of April 2018 06:43:46 PM
Old 04-02-2018
gnu?
Code:
string='# -*- coding: utf-8; mode: tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -\\*- vim:fenc=utf-8:ft=tcl:et:sw=2:ts=2:sts=2'

sed -i '1{/^#./! s/.*/'"$string"'/}' test.tcl

This User Gave Thanks to rdrtx1 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing all but last Hex characters in a text line

I must remove hex characters 0A and 0D from several fields within an MS Access Table. Since I don't think it can be done in Access, I am trying here. I am exporting a Table from Access (must be fixed length fields, I think, for my idea to work here) into a text format. I then want to run a... (2 Replies)
Discussion started by: BAH
2 Replies

2. Shell Programming and Scripting

checking text file

Hello, I have the following report (report.txt) file (see attached). I would like to check the file and if the field is error, then showing error message at output. 1. In the report, 1st, 2st and 3nd line can be ignore to check 2. start to check line 4 (each field use "," to split - 1st... (1 Reply)
Discussion started by: happyv
1 Replies

3. Shell Programming and Scripting

Delete a line in a file starting with - Perl one-liner

Hi I need a perl onliner to delete a line in a file starting with few words. Example file.txt ---------- my name is don I live in London I am woking as engineer I want to delete a line starting with 'I live in' using perl oneliner and in place edit with out temporary files Thanks... (2 Replies)
Discussion started by: ammu
2 Replies

4. Shell Programming and Scripting

Replacing Awk with One-liner Perl

can someone help me translate the following command, from: /usr/bin/awk "/^$TOFDAYM $TOFDAYD /,0" $LOGFILE to something like perl -e ..... basically, i want to use perl to do awk functions within a shell script. i want to do the above awk, using perl. any suggestions? (9 Replies)
Discussion started by: SkySmart
9 Replies

5. Shell Programming and Scripting

Replacing text on every third line

I have file like this "copy table_name from filea.txt on node replace delimiter '|';" "copy table_name from fileb.txt on node replace delimiter '|';" "copy table_name from filec.txt on node replace delimiter'|';" "copy table_name from filee.txt on node replace delimiter '|';" "copy... (1 Reply)
Discussion started by: nnani
1 Replies

6. Shell Programming and Scripting

Replacing text in Perl given by command line

Hi I need to write a Perl script that the file given as first argument of the command line that will find all occurrences of the string given as the third argument of the command line and replace with the string given as the fourth argument. Name newfound file is specified as the second... (3 Replies)
Discussion started by: nekoj
3 Replies

7. Shell Programming and Scripting

Checking whether the entered text is file or not

how to check that the "file path" entered by the user has the valid file. (6 Replies)
Discussion started by: Rashid Khan
6 Replies

8. Shell Programming and Scripting

[Solved] Replacing line of text while file is closed

Is it possible to replace a line of text within a file while it's closed with a single command or a script? Please show me an example or point me to a webpage that shows an example. The file has this line of text: LoginGraceTime 100 I want to replace it with the following: ... (2 Replies)
Discussion started by: wdg74
2 Replies

9. Shell Programming and Scripting

Add previous text when replacing comma with new line

Hi, I've got this output: # cat test2.txt TM1ITP1-TMNLSTP1 SLC00=0,SLC01=0,SLC02=0,SLC03=0 if I just use cat test2.txt | tr "," "\n" I'll end up very near to what I'm trying to achieve: TM1ITP1-TMNLSTP1 SLC00=0 SLC01=0 SLC02=0 SLC03=0 But how can i eventually add the term... (1 Reply)
Discussion started by: nms
1 Replies

10. UNIX for Beginners Questions & Answers

Perl one liner in bash script not replacing hours and minutes [HH:MM]

Hi I want to replace time stamp in the following line PROCNAME.Merge.exchMon.CODE.T_QSTART 08:45 read assuming the new time stamp is 09:45 ; the line is getting replaced as below :45 read I'm trying to use the perl one liner in bash script perl -pi... (4 Replies)
Discussion started by: charlie87
4 Replies
PAPS(1) 						      General Commands Manual							   PAPS(1)

NAME
paps - UTF-8 to PostScript converter using Pango SYNOPSIS
paps [options] files... DESCRIPTION
paps reads a UTF-8 encoded file and generates a PostScript language rendering of the file. The rendering is done by creating outline curves through the pango ft2 backend. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. --landscape Landscape output. Default is portrait. --columns=cl Number of columns output. Default is 1. Please notice this option isn't related to the terminal length as in a "80 culums terminal". --font=desc Set the font description. Default is Monospace 12. --rtl Do right to left (RTL) layout. --paper ps Choose paper size. Known paper sizes are legal, letter and A4. Default is A4. Postscript points Each postscript point equals to 1/72 of an inch. 36 points are 1/2 of an inch. --bottom-margin=bm Set bottom margin. Default is 36 postscript points. --top-margin=tm Set top margin. Default is 36 postscript points. --left-margin=lm Set left margin. Default is 36 postscript points. --right-margin=rm Set right margin. Default is 36 postscript points. --gutter-width=gw Set gutter width. Default is 40 postscript points. --help Show summary of options. --header Draw page header for each page. --markup Interpret the text as pango markup. --lpi Set the lines per inch. This determines the line spacing. --cpi Set the characters per inch. This is an alternative method of specifying the font size. --stretch-chars Indicates that characters should be stretched in the y-direction to fill up their vertical space. This is similar to the texttops behaviour. AUTHOR
paps was written by Dov Grobgeld <dov.grobgeld@gmail.com>. This manual page was written by Lior Kaplan <kaplan@debian.org>, for the Debian project (but may be used by others). April 17, 2006 PAPS(1)
All times are GMT -4. The time now is 08:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy