General :: Split A File Into Two - The First Being The First Two Lines And The Second The Rest?
Nov 1, 2010
I'd like to split a file into two, where the first file is the first two lines and the second is the remaining lines (third line to EOF).
View 2 Replies
ADVERTISEMENT
Aug 5, 2010
when I run the following command:
awk -F, '{print $10 "," $5 "," $1 "," $3 "," $4 "}' myfile > tmpfile
tmpfile displays the lines but they are all cut off and placed on the line below at the same point.
View 1 Replies
View Related
Dec 9, 2010
I need to grep a pattern which can be present in one line or could be split in 2 lines.Normal grep wont work in this case. Can anyone please help on this?There are 100's of files in which i need to search for this pattern so time is also a constrain.
View 5 Replies
View Related
Oct 26, 2009
I have this massive table file with some data in it and I want to replace some lines that are wrong with the correct ones that are in another table file of the same format. The wrong lines are not all together in a block but randomly distributed so I need to make a loop checking if the line is in the other file and if it is, replace it. I want to try and do it with sed or awk but I don't really know how to....
View 12 Replies
View Related
Jun 4, 2010
How can i split a string like this,
Code:
This is my first line.
This is my second line.
This is my third line.
into,
Code:
"This is my first line.", "This is my second line.", "This is my third line."
in C++.
i.e. split the code at every new line
View 11 Replies
View Related
May 20, 2011
Im in a unique situation where a box has a 400G file, on FreeBSD, without thesplit' utility available
View 11 Replies
View Related
Jan 13, 2011
I have a 7 GB VOB file which I created from a DVD using ffmpeg dump to remove CSS protection (it is legal where I live to do so). Now, I want to create a DVD/.iso that will be understood by regular DVD players/appliances. How do I do it?
View 1 Replies
View Related
Aug 5, 2010
I have a file with 5 columns. Column 4 contains numbers.Is it possible to split the file into multiple files using a condition for the contents of column 4 i.e if column 4 contains a value between 0-10 then print the lines to a new file called less_than_10.txt
View 1 Replies
View Related
Sep 1, 2011
Tool like Media File Segmenter for Linux
I know that one can use ffmpeg to extract a smallfile.avi from a largfile.avi. But What I am looking for is an tool/command to split a large file into several files of a given size.
View 1 Replies
View Related
May 30, 2011
I've a file with a size of 6GB. I would like to compress this file and split them into smaller files. I was also thinking in use bzip2 to compress it, because if offers a good compression rate. How can I split this file into small ones to compress it?
View 5 Replies
View Related
Jan 21, 2011
standard Linux installation utilities split the root file-system and the home file-system on two separate but relatively equal-sized partitions? For example, when I put fedora on an 80GB disk, it automatically gave the root file-system 32GB and home 30GB and the swap 8GB of space. However, since my home file-system has a directory with 28GB of files in it, why is my root file-system reading 100% usage? Is the home FS overlaid on top of the root FS? Is there an advantage to doing this? I just made a boot partition (50mb or so), a root partition (90% of the disk space) and a swap (4%-5% disk space).
View 5 Replies
View Related
Apr 16, 2011
I am removing some old graphics from my server and one of the gallery programs have created two enormous directories that I cannot even open with FTP.
I tried to tar each directory and the first came out to about 37gb and the second keeps failing (its bigger one would assume).
How can I archive and split these into smaller files?
View 13 Replies
View Related
Sep 17, 2009
I'm looking for a way to insert the number of lines in a file to the start of the aformentioned file. This should be simple but as I am not used to scripts in Linux, I am finding it tough going. I can find the number of lines in a file easily enough via
filesize=$(awk 'END {print NR}' $1)
but as for inserting this into the first line, i'm failing to do so. I've tried some of the other approaches on these forums but none so far have been able to do so.
I've tried:
sed '1i$filesize' $1
but sed i requires a string, not a variable so no go I've also tried:
mv "$1" "${1}.bak" 2>/dev/null || touch "${1}.bak"
cat $filesize "${1}.bak" >"$1"
but again with no luck as cat seems to need an input stream Just to recap, i want to insert a line at the start of a given file that holds the number of lines the original file has.
ie the file:
a
b
c
d
e
should become:
5
a
b
c
[code].....
View 3 Replies
View Related
May 12, 2010
I am using RHEL 5.I have a very large test file which cannot be opened in vi.The content of the file has some 8000 lines.I need to view ten lines between 5680 to 5690.How can i view these particular lines in a large file.what is command and option i need to use.
View 1 Replies
View Related
May 17, 2011
How does one split a large linux file and transfer to windows external drive ?
View 2 Replies
View Related
Jan 18, 2010
have a gzip file ABC_000023232.gzipBCD_023232032.gzipI want to split these files into smaller files but keep the extension same because I am using this as a variable in a script
Code:
for i in `ls *.gzip`
split -b 500K $i $i
[code]...
View 3 Replies
View Related
Jan 6, 2011
I have a large text file containing over 180k lines and another text file containing about 1k. I would like to remove lines in the 180k-line file that exist in the 1k-line file.
View 5 Replies
View Related
Apr 17, 2009
I would like to modify the content of a text file in Linux, in the following way:=> the file has several of these lines:./run_pest3 ./g134366.04080_0.062 x 2_d043 1 0.43 results_EC=> I want to modify all lines to be:./run_pest3 ./g134366.04080_0.062 x 2_d043 1 0.43 results_EC0.062i.e., the last number of $2 should be "attached" to the end of $7, for each line.
View 5 Replies
View Related
Aug 5, 2010
I have a file similar to this:
I need to print the last line for each user into a file. The resulting file should look like this:
Is there a way that AWK can match lines from $1 and then print the last line into a file?
View 7 Replies
View Related
Feb 22, 2010
I'm trying to output two certain fields of a very large text file to 2 very small text files. Then take those files and add all the lines together to come up with a total from each file (two totals).
Here's what I've got:
Code:
#!/bin/bash
echo "0" > /media/in.txt
echo "0" > /media/out.txt
[code]....
Breakdown: Put 0 in a text file to be drawn by respective while loops for math later
Output last 60 integers to a file for total A (new integer every minute)
Output last 60 integers to a file for total B (new integer every minute)
The two while loops are supposed to be adding the lines together. The echo commands at the end are for testing purposes, just to see the output. However, when I run this, I get the output of
Code:
0 0
Which is obviously not what it's supposed to be. Is there a more efficient way to do this or am I missing something in the script that would reset the values to "0"?
View 2 Replies
View Related
Jun 5, 2011
looking to delete the last 6 lines of a file with sed. figured out how to delete the last line..but i want the last six.
View 6 Replies
View Related
Aug 2, 2010
I need to add a line in a file before the last two lines using a script using standard linux editors like sed but i can't figure it out.
View 2 Replies
View Related
Jun 21, 2010
I'm having a file with repeated particular text lines. So I need to view the file content ignoring these lines. Is there anyway I can achieve this using VI
View 2 Replies
View Related
Mar 10, 2011
I am facing some problem regarding deletion of a line from a text file. The file consists of the lines of type which consists of more than 6 occurrences of : character in it. The line should be deleted completely and the line next to it must be shifted up.
View 1 Replies
View Related
Jul 20, 2010
I have a file that contains 100 ligns, i need to write a script that read 70 lignes and redirect those 70 ligns to another files and these 70ligns have to be erased in the first file
when i write this command
head -70 somefile.txt>test.txt
or
sed -n 70p somefile.txt>test.txt
i have these 70 lines in the text.txt files
but these 70 lines have to be deleted inthe first file somefile.txt
View 1 Replies
View Related
Apr 27, 2010
i've got a file with sorted words - one on each line.How could it be possible to delete thouse lines that have words of length 1 or 2 (1-2 letters). I guess a good way it will be with AWK, n its fuction length(), but getting it, i dont know how to delete those very lines.
View 14 Replies
View Related
Feb 16, 2011
I have following contents
I want to grep "#2" and want the output as
How to using shell script?
View 6 Replies
View Related
Aug 6, 2010
When i want to remove particular lines containing a specific word in from entire document at a time,i am using the following command.
awk '$columnno !~/specificword/' inputfile > outputfile
But here, coulmn no is my problem, because iam having this in different columns. So i need a solution for it.
How to write such removal command without mentioning column no. , ie irrespective of column no, it has to remove all lines having that specific word.
View 10 Replies
View Related
Jul 27, 2011
I have a few rather large text files, and I need a way to look at the first three lines of each. Is there a way to do this using awk?
View 3 Replies
View Related
Nov 16, 2010
OS: Ubuntu 10.04 LTSEmulator: Wine 1.2Program: Propellerhead's Reason 5.0After some toil, I successfully installed Reason on linux. Hurrah.However, the default audio drive failed, and now it doesn't have an audio card selected. .. but this isn't my problem.I would love to go into Options to try and tinker with the settings, but I can't click on it. In fact, I can't click on anything in the window's toolbar (ie File, Edit, Options, Help, etc)The rest seems to work just fine.
View 2 Replies
View Related