10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Shell : bash
OS : RHEL 6.8
I have a file like below.
$ cat pattern.txt
hello
txt1
txt2
txt3
some other text
txt4
I want to remove all lines in this file except the ones starting with txt . How can I do this ? (4 Replies)
Discussion started by: omega3
4 Replies
2. Shell Programming and Scripting
Hello,
I'm looking to check only the first line of a file to see if it is a format string, like
# -*- 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=2if the first line is anything else, insert the above string.
I'd... (3 Replies)
Discussion started by: f77hack
3 Replies
3. UNIX for Dummies Questions & Answers
e.g.
File name: File.txt
cat File.txt
Result:
#INBOUND_QUEUE=FAQ1
INBOUND_QUEUE=FAQ2
I want to get the value for one which is not commented out.
Thanks, (3 Replies)
Discussion started by: Tanu
3 Replies
4. Shell Programming and Scripting
Hi all,
I need a Perl one liner which prints a newline into a .txt file, only where the line starts with "/mediawiki-1.19.0/". It should add the newline to the line before.
My problem is, when I try to realize this (with my little knowledge :rolleyes: ) i come to the point where the // are... (4 Replies)
Discussion started by: Mr.Smith
4 Replies
5. Shell Programming and Scripting
Folks,
How do i delete an entire line that starts with blank space?
Ex: I have a file like below.
abc def (10/12) ghi
_________ jkl
_________ mno
pqr stu (11/12) vwx
I need the ouput like
abc def (10/12) ghi
pqr stu (11/12) vwx
Thanks for your elp in advance !!!! (2 Replies)
Discussion started by: jayadanabalan
2 Replies
6. Shell Programming and Scripting
Thanks for giving your time and effort to answer questions and helping newbies like me understand awk.
I have a huge file, millions of lines, so perl takes quite a bit of time, I'd like to convert these perl one liners to awk.
Basically I'd like all lines with ISA sandwiched between... (9 Replies)
Discussion started by: verge
9 Replies
7. Shell Programming and Scripting
My data is xml'ish (here is an excerpt) :-
<bag name="mybag1" version="1.0"/>
<contents id="coins"/>
<bag name="mybag2" version="1.1"/>
<contents id="clothes"/>
<contents id="shoes"/>
<bag name="mybag3" version="1.6"/>
I want to delete line containing mybag2 and its subsequent... (5 Replies)
Discussion started by: repudi8or
5 Replies
8. Shell Programming and Scripting
I want to delete initial N bytes of a file using sed.
How can I do that? (3 Replies)
Discussion started by: jockey007
3 Replies
9. Programming
Hi,
I want to delete the initial few lines (or even bytes) from a file.
I want to do this from a C function & this is in Linux platform.
The truncate & ftruncate is allowing me to delete bytes from the end only.
Any linux C function calls or ideas or any suggestions??
I'm in a dead... (2 Replies)
Discussion started by: jockey007
2 Replies
10. Shell Programming and Scripting
Is it possible to delete the last line in a file usin awk or perl? (4 Replies)
Discussion started by: suman_jakkula
4 Replies