|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Deleting Lines from a file.
I am trying to remove the first 39 lines from a file and redirect it to a new file. Below is how I understand the command to work and the error I get.
> sed [1[,39]]!d apextout2 >apextout sed: [1[,39]]!d is not a recognized function Hopefully someone can help. Thanks Jason |
|
#2
|
|||
|
|||
|
Code:
sed '1,32 d' delete lines 1 thru 32 |
|
#3
|
|||
|
|||
|
alternatively:
sed -ne '39,$p' fillename |
|
#4
|
|||
|
|||
|
Both worked great from the command line, but when I put it in a ksh script it hangs. Here is my script.
Thanks! #!/bin/ksh ls /tmp/PROD/tibapext*>apextout read file1 file2 file3 file4<apextout echo $file1 sed -ne '39,$p' $file > /home/indus/scripts/apext.txt |
|
#5
|
|||
|
|||
|
Got it, I had $file instead of $file1.
Thanks for the help. Jason |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Deleting Lines from a file. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|