LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-12-2012, 06:04 PM   #1
micronemo
LQ Newbie
 
Registered: Aug 2012
Posts: 14

Rep: Reputation: Disabled
Insert multiple lines in specificic position with sed or awk


i have a file "pippo.txt" with 10 line of text . i must add a blank line in 4 and 7 position.
someone can help me ?
thanks very much
 
Old 09-12-2012, 06:44 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Just open the file with a text editor---why would you need SED or AWK?

If you need to do it with SED, here's the command:
http://www.grymoire.com/Unix/Sed.html#uh-41

(That site is the #1 tutorial on many things---covers AWK also)
 
Old 09-12-2012, 07:01 PM   #3
micronemo
LQ Newbie
 
Registered: Aug 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
this command go in bash script
 
Old 09-13-2012, 06:23 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,515

Rep: Reputation: 2892Reputation: 2892Reputation: 2892Reputation: 2892Reputation: 2892Reputation: 2892Reputation: 2892Reputation: 2892Reputation: 2892Reputation: 2892Reputation: 2892
And what have you done towards solving the problem? (apart from asking the question)
 
Old 09-13-2012, 06:27 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by micronemo View Post
this command go in bash script
Did you look at the link I provided?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using sed/awk to replace a string at a given position in anoopvraj Linux - Newbie 6 05-30-2009 07:59 AM
Inserting Multiple Lines (with newline) using sed or awk hal8000b Programming 1 03-08-2009 05:21 PM
Insert character by using sed/awk manish_meet_in Linux - General 3 04-05-2007 12:19 PM
AWK/SED Multiple pattern matching over multiple lines issue GigerMalmensteen Programming 15 12-03-2006 05:08 PM
awk/gawk/sed - read lines from file1, comment out or delete matching lines in file2 rascal84 Linux - General 1 05-24-2006 09:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration