LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-12-2017, 07:52 AM   #16
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,856
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869

If you could clearly state what do you want to achieve, you would get (even more) help. Please note, nobody here is mind-readed or clairvoyant.
 
Old 03-12-2017, 09:27 AM   #17
pedropt
Member
 
Registered: Aug 2014
Distribution: Devuan
Posts: 345

Original Poster
Rep: Reputation: Disabled
Quote:
Please note, nobody here is mind-readed or clairvoyant.
Never crossed my mind that sed or awk could not create a line in an empty file and that it needed some text on the file to guide itself during the process of finding the line i wanted , and this is why i assumed automatically that code was not working on the first post i made .

You guys can be sure that i will not be the only one that made this perception error , on the net exists more people with the same perception i had on that tool .

However , i already solved my issue here .

Thanks for all you guys patience on this issue .
 
1 members found this post helpful.
Old 03-12-2017, 01:40 PM   #18
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by pedropt View Post
You guys can be sure that i will not be the only one that made this perception error , on the net exists more people with the same perception i had on that tool .

However , i already solved my issue here .

Thanks for all you guys patience on this issue .
It would be nice if you would share your solution in this thread to help others with similar problems or perception.

Remember, your posts here will appear in search engine results for a long time to come and LQ is all about sharing our knowledge with each other. Please share your own with us!

If your problem is resolved, please use the Thread Tools options at top of each thread to mark it as solved.

Last edited by astrogeek; 03-12-2017 at 01:42 PM. Reason: Added solved comment
 
Old 03-12-2017, 04:27 PM   #19
pedropt
Member
 
Registered: Aug 2014
Distribution: Devuan
Posts: 345

Original Poster
Rep: Reputation: Disabled
My solution to solve that particular issue was to rearrange my original script to put data in the order i needed instead using sed to create change the file . For that i used echo .

example : original order were i needed sed and where sed had to write the first line and other lines in organized order :

5
7
3
1
4

So , i changed my original script and used echo to write the variables i needed to avoid using sed .

1
2
3
4
5
6
7

I was trying originally to use sed because my script have almost 2000 lines and other scripts that work in conjunction with what this script will write .

Well , its complicated but the solution was that one .

Last edited by pedropt; 03-12-2017 at 04:28 PM.
 
Old 03-13-2017, 06:41 AM   #20
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,894

Rep: Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014
You can seed it with 'yes' if you need to do something like that with sed, though there are probably better tools for generating files from templates (which is essentially what we're doing here):
Code:
yes '' | sed -e '3s/.*/line in the middle/;5q'

Last edited by GazL; 03-13-2017 at 06:50 AM.
 
1 members found this post helpful.
  


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
sed add line under a specific line in a file aristosv Linux - Software 4 08-30-2015 02:34 AM
[SOLVED] Filter through line/s to grab specific fields/data in the line with example shayno90 Linux - Newbie 11 10-14-2009 11:51 AM
php - Read file line by line and change a specific line. anrea Programming 2 01-28-2007 01:43 PM
vb.net writing to a specific line in a text file mrobertson Programming 3 12-30-2005 10:24 PM
Writing to a specific line in a text file mrobertson Programming 6 12-30-2005 04:02 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:52 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
Open Source Consulting | Domain Registration