Software :: Divide A Big File Into Small Pieces, Each Has Same Number Of Lines?

Oct 16, 2009

I am wondering if there is some command (sed ?) that could do divide a big text file into small pieces, each of which contains 10 lines

View 1 Replies


ADVERTISEMENT

General :: Script To Insert Number Of Lines In A File To The Start Of The File?

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

Ubuntu :: Count The Number Of Lines That Are Unique To The File?

Jan 21, 2010

I recently found myself in possession of a large file (a few million lines in length) of short strings and would like to count the number of lines that are unique to the file. I thought this would be an easy process, but while working on the problem, I encountered the following. Can anyone explain this weird result to me?

Code:
alaric@alaric-laptop:~/Documents/Programming$ grep '^string$' file.txt | uniq | wc -l
1

[code]....

View 1 Replies View Related

Ubuntu :: Create A Script To Count The Number Of Lines From A Text File?

Dec 17, 2010

I need to create a script to count the number of lines from a text file . The output must be put on another text file (no_lines.txt) and in this file i need to generate from the script this output :"File $FILE has $NO_LINES lines ".

View 3 Replies View Related

General :: Count The Number Of Lines Inside A File And Put The Output Into A Variable?

Feb 1, 2011

i need to count the number of files and put the output into a variable. i used wc -l filename but i couldnt find an option to put the output to variable. example if the number o line is 5, i need the output of echo $x is 5.

View 3 Replies View Related

Ubuntu :: Small White Lines Over The Screen, Like Every 3 Line?

Aug 19, 2010

I have noticed that there are some tiny white scanlines over the screen in linux, is this something known? specific graphics cards? just an issue with my setup?

Its hard to explain but its even horizontal scanlines, like small white lines over the screen, like every 3 line... was wondering if its my geforce 8800 or what it is?

View 5 Replies View Related

Ubuntu :: Can't Reduce The Number Of Lines On Screen?

Feb 26, 2011

I am not sure if this is really a Ubuntu question but lets try it!Received email shows a long header which includes lines of code. I can scroll through it but I can't reduce the number of lines on screen.This significantly reduces the number of lines available for the message. There must be a way to reduce or eliminate this header.

View 2 Replies View Related

Fedora Installation :: Total Number Of Lines And Characters

Dec 25, 2010

View the entire contents of the file / etc / passwd, showing first 10 lines of file / etc / group, 10 displayed the last line of the file / etc / group. And
- The total number of lines and characters in file pwd and grp

View 2 Replies View Related

General :: Count The Number Of Lines In All Files In This Directory?

Jul 5, 2011

I want to count the lines of all files in this directory and all its subdirectories, but exclude directories "public", "modules", and "templates".

View 2 Replies View Related

General :: Count Total Number Of Lines Of Found Files?

Mar 20, 2011

I'm running a find. -name pattern to find some files, and I'd like to elegantly get the total number of lines in these files. How can I achieve that?

View 4 Replies View Related

General :: Replace Several Lines In A File With Other Lines In Another File?

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

Programming :: Bash Script To Count Number Of Lines With A Specific Property7?

Aug 11, 2010

I would like to parse an input file in which there are two columns per each row. We want to see how many lines are duplicated where we define duplicate to be having the same second field and different first field. For instance if the input file looks like the following:

79874 13131
79873 12309
79820 13131

[code]...

View 10 Replies View Related

Ubuntu Networking :: Unable To Connect To A Small Number Of Random Websites: Otherwise Networking Is Fine

Dec 29, 2010

I was having no problems (that I knew of) browsing the web since installing Ubuntu 10.10 a week or so ago. I was previously trialling Win7 as my customers will likely be using that in the future. Then I wanted to go to internode.on.net. Got the following: Quote: Firefox can't establish a connection to the server at internode.on.net. or Quote: Oops! Google Chrome could not connect to internode.on.net

As it was just after Christmas I thought it must be down, for upgrades or maintenance etc. I later tried to go to Freebsd.org; same error. I've been having a small number of other websites give the same error. I thought nothing of this until I tried it on my wife's macpro. I could log onto all the websites I wanted to and none gave any indication of having been down. Both boxes are on the same adsl connection. I still can't access internode or freebsd on 10.10 yet have been able to access every website on OSX. Now, I was only looking at them for info but am worried I won't be able to access something important. (so far everything I 'need' is working)

ping just drops out. edit: weirdest thing! I just retried and now can not emulate the problem for internode. freebsd still won't show. that is less than five minutes between problems and resolution! I hadn't even posted! But I still would like to have an idea of what is going on. Here is the ping error for freebsd: Quote:

[Code]...

View 9 Replies View Related

OpenSUSE Network :: Add Few Lines To Php.ini File And Modify Suhosin File?

Dec 29, 2009

Is installing "php5-suhosin" from yast and restarting apache enough to make suhosin work out of the box? Or do I need to add few lines to php.ini file and modify suhosin file?

View 3 Replies View Related

Ubuntu :: Netbeans - Whenever The File Contains More Than 3000 Lines,the File Is Not Readable?

Mar 4, 2010

HI am facing the strange issue in netbeans on ubuntu 9.04. whenever the file contains more than 3000 lines the characters overlap on each other and the file is not readable, where as if the file is less than 3000 lines it works fine. what may be the reason ?

View 2 Replies View Related

General :: View A Particular Ten Lines In A Large File Where Can't Open The File In Vi

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

Programming :: Sed Delete Lines From File One If Regexp Are Listed In File Two?

Sep 17, 2009

I am trying to delete lines of a file if they contain text that is present on another file. For example

> cat one.txt:

a
b
c
d

[code]....

I get the following output:

> ./test.sh one.txt two.txt
a
b
d
e

[code]....

View 6 Replies View Related

Red Hat :: SCP File To All In Small LAN Network

Sep 23, 2010

I have a small lan network. I known the passwords of all and I want to scp a file to all and I don't want to give password each time. Is there any way for that through writing script.

View 1 Replies View Related

General :: Divide A Partition Into Two Parts?

Jul 10, 2009

I am having a big /home partition. I need to make it small and create one more partition from it which will be used for some other purpose. Can you tell me please how to do it?
I searched on google and found some methods which were very different from each other.I don't know which one is good, so, I thought I will ask you experts before doing anything.

View 9 Replies View Related

Programming :: Insert Each Line Of One File To The Another File After Certain Lines?

Jul 2, 2010

i have two files with thousands of line, I am trying to combine these two files but i want to insert each line of one file to the another file after certain lines. I am using awk with the following command but it does not work.cat file1 | awk ' { print $0; if (NR%3004==0) {print "file2"}}' > outputfile

View 14 Replies View Related

Ubuntu :: Shell, Auto Append Number To File And Read From External File?

Oct 31, 2010

Code:
cat ${SOURCE}/{start,universal,index,end}.txt > ${SERVER}/index.html
cat ${SOURCE}/{start,universal,02042010,end}.txt > ${SERVER}/02042010.html

[code]....

View 3 Replies View Related

Fedora :: Unable To Compress Into Multiple Pieces?

Dec 19, 2010

I need to be able to compress into multiple pieces while still being able to be read by someone else who has windows, I can only download unrar but not rar. Why is this?

View 2 Replies View Related

General :: Divide Shell Space Into Two Parts?

Sep 9, 2010

On my c shell, I use the alias p ls -lt; pwd to speed up things while switching directories and getting their listings.Things could be much easier if I could somehow divide the space I have on my console in two parts such that the prompt is in the lower part and the top part always shows the listing of the current directory (the directory which I am using in the second part).The upper part needs to be dynamic in the sense that whenever I switch directories using the prompt in the lower part, It should give the listing of the current directory in the upper half.

View 3 Replies View Related

Software :: Divide Hard Disk To Install 11

Jun 28, 2011

How to divide hard disk to install suse 11.

How many partition I have to choose

What kind of format;ext2 or ext3

View 1 Replies View Related

General :: Print - File Server - Small

Jan 25, 2009

I love the look of FreeNAS, but it does'nt do print server!

Must Have:

Run off a USB Flash Drive
File share with Windows (I want to backup to it)
Be a print server to a laser printer (USB interface)
Be remotely controlled once it is setup(don't have a spare screen and it's going in a spare room/corner BUT I will need to use a GUI for setup)
Free (thats why I won't use Windows)
Run OK on a P3

Preferred:
Power management
Wireless adapter compatible

View 2 Replies View Related

General :: Big Or Small Swap File Size?

Jan 14, 2010

Should the swap file be as large as possible or as small as possible providing a person has 8GB of installed ram.

View 14 Replies View Related

Programming :: Send File With FTP From Small Version?

Feb 9, 2011

I have this problem.I need to do this:I got a small version of Linux installed in some small devices. These devices come from the provider with this small version of Linux installed.This devices should send data to some other machine in the internet. I have tested wput for this purpose with a PC which has an Ubuntu version 10 and it works fine. However, when I try wput in the small device, I get an error. It seems that the wput might need some libraries to work with the small version of Linux installed in the small device.The fact of using wput or not is optional. I just need being able to send files through ftp with this small version of Linux.The thing is that to be able to run wput in this small version of Linux, it seems that many of the needed libraries were missing. So what I did was just install all the needed libraries. But still the wput program fails in its first line.

View 14 Replies View Related

Fedora Networking :: Divide Equal Bandwidth Between / Among Clients

Mar 3, 2010

how to Divide Equal Bandwidth between / Among Network Clients? e.g if there is total bandwidth = 10Mbps and only 5 clients are online then bandwidth should be divided evenly i.e each client to 2Mbps and if 20 clients are online then 0.5Mbps to each client automatically. [in windows this can be done by bandwidthcontroller software now how it can be done in linux]

View 3 Replies View Related

General :: Archiver Supports Splitting Archive Into Pieces?

Apr 27, 2010

I need files to be <= 5GB to put on S3. Right now I have an ugly tar / gzip / cut before upload, then cat / zcat / tar on download, but it's really ugly - and nearly every archiver should support archive splitting right? What's the best way?

View 2 Replies View Related

Networking :: Using SFQ Queue To Divide Bandwidth Per Connection / Computer

Feb 4, 2010

Can the SFQ queue be used to divide bandwidth not only per connections but also per computer? E.g. if two computers download something each computer gets half of the bandwidth. I'm trying to do my own script based on wondershaper and would want to divide the bandwidth between all devices so that one device can't saturate the uplink.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved