First please excuse me for my poor english, i am french. Thank you for reading this thread and potentially helping me.
I have a 300ko file of one line (without any \n)
I want to create a new flat file with \n every 592 characters
I tried with some sed commands, but i am not very skilled...
I first found out that in a regexp you can't use the {number} pattern with a number larger than 255, so i tried this
but i only get a empty file...
If you see what's wrong, or if you have another idea... maybe a awk ? or another command i don't know...
Thank you
I want to create a new flat file with \n every 592 characters
I tried with some sed commands, but i am not very skilled...
I first found out that in a regexp you can't use the {number} pattern with a number larger than 255, so i tried this
but i only get a empty file...
If you see what's wrong, or if you have another idea... maybe a awk ? or another command i don't know...
Thank you
Just a small change to your command will do the job..By the way there is no need to use cat. Give the input file to sed as below..
This User Gave Thanks to michaelrozar17 For This Post:
wow! i don't expected such quick and accurate answers, this unix.com is a great place
@itkamaraj : the command fold is exactly what i need, thank you very much ! it works very well
@michaelrozar17 i found the syntax with cat in the man sed, but indeed your syntax is simpler. i tried your suggestion with the \( ... \) but it does the same thing, i get an empty file. But i will use the "fold" command, so there is no real need to go further in this way.
Ok .. This is driving me nuts. I suppose I need another set of eyes.
Example Data
interface Vlan1
description xxxxxxxxxxxx
ip address 192.168.1.1 255.255.255.252
no ip redirects
no ip proxy-arp
ip flow ingress
ip pim sparse-mode
load-interval 30
!
interface Vlan2
... (5 Replies)
Sed command to replace a line in a file using line number from the output of a pipe.
Is it possible to replace a whole line piped from someother command into a file at paritcular line...
here is some basic execution flow..
the line number is 412
lineNo=412
Now i have a line... (1 Reply)
i have few lines in a file... i am reading them in a while loop so a particular line is held is $line1.. consider a modified line is held in $line2.... i want to replace $line1 with $line2 in the same file... how to do it..?
i have come up till the below code
sed "s/$line1/$line2/g" tmpfile.sql... (5 Replies)
Hi All,
I need to copy a specific line from a file to another file.
lets suppose the line number 13 of a file
when I am writing the line number explicitly.. its working fine
sed -n '13p' afile > anotherfile
but, when inside a script, i am getting the line number value inside a variable... (4 Replies)
Dear all,
I am trying to extract a number from a line in one file (task 1), duplicate another file (task 2) and replace all instances of the strings 300, in duplicated with the extracted number (task 3). Here is what I have tried so far:
for ((k=1;k<4;k++)); do
temp=`sed -n "${k}p"... (2 Replies)
I have a file, from where I need to extract some data. But, the condition is like following :
The script will read line by line,while checking if any line starts with 'MN'. If found true, it looks for if the immediate line starts with 'PQ' or not. If its true then, extract few fields from that... (1 Reply)
I have two files.
Fileone contains
text string one
text string two
text string three
Filetwo contains
Name:
Address:
Summary:
Name:
Address:
Summary:
Name:
Address:
Summary:
I would like to use sed to read each line of file one and put it at the end of the summary line of file... (3 Replies)
Hi, I am trying to write a script that will replace "PermitEmptyPasswords yes" with "PermitEmptyPasswords no". The following does not seem to work: -
sed 's!/"PermitEmptyPasswords yes"/!/"PermitEmptyPasswords no"/!'
Appreciate any ideas.
Thanks (2 Replies)
sed "/$titlesearch/d" movielist
will delete any line in the file movielist that matches $titlesearch, but this is only a screen print correct ?
how can I have sed to actually delete the line from the file so that it doesnt appear next time I open the file ?
thanks
Steffen (8 Replies)