Server :: Set The Cat Command To Read Specified Lines Of A Text File?

Feb 17, 2011

how can I set the cat command to read specified lines of a text file,like if I have a text file with 100 lines, who can I say cat only line 23 to 42?

View 3 Replies


ADVERTISEMENT

Programming :: Read Multiple Lines From A Text File?

Mar 11, 2011

For example, I have a text file with data which lists numerical values from two separate individuals

Code:
Person A
100

[code]...

View 1 Replies View Related

Programming :: (BASH) How To Read Multiple Lines From Text File

Mar 11, 2011

For example, I have a text file with data which lists numerical values from two separate individuals

Code:
Person A
100
200
300
400
500
600
700
800
900
1000
1100
1200

Person B
1200
1100
1000
900
800
700
600
500
400
300
200
100

How would I go about reading the values for each Person, then being able to perform mathematical equations for each Person (finding the sum for example)?

View 13 Replies View Related

CentOS 5 :: Search A Text File For The Existence Of Certain Strings And Execute A Command If They Exist, Something Along The Lines?

Feb 23, 2010

This should be simple but I can't seem to find what I am looking for.I want to search a text file for the existence of certain strings and execute a command if they exist, something along the lines of:

if <string> exists
command
or

if <any member of this list exists>
command

I know how to manually search a file with grep, cat, etc., but the "if this exists" part eludes me.

View 7 Replies View Related

Programming :: Remove Lines In A Text File Based On Another Text File?

Jan 28, 2009

I have a text file called file1.txt containing many lines eg.

line1
line2
line3
line4
line5
line6

Then i have another text file called file2.txt contains

3
5
6

Is there a command to remove the lines in file1.txt based on the keywords in file2.txt? note: It should remove line3,line5,line6 based on 3,5,6

View 10 Replies View Related

Programming :: Adding Lines Of Text To Beginning Of Text File

Jan 19, 2009

I need to insert 3-4 lines of text to the beginning of a text file. The file is a largish MYSQL dump, the result of a backup shell script. This shell script should insert the required text.I've wrestled with sed, but lost.

View 2 Replies View Related

OpenSUSE :: Count Lines In Multiple Text Files From Command Line?

Apr 27, 2010

I want to (from the command line) be able to counte lines in a bunch of files of a specific type in a folder and all its sub-folders. How would I do this?

View 1 Replies View Related

General :: Use AWK To Print Out First Few Lines Of A Text File?

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

Programming :: Add Comma To End Of Lines In Text File?

Aug 21, 2010

I have a plain text file with 360 lines of varying length text. How do I add a comma or other symbol to the end of each line so that I can convert the file to csv format that I can open in a spreadsheet (45 rows, 8 columns). That means each 8 lines of text forms 8 columns, with 45 rows.

View 9 Replies View Related

General :: Grep Multiple Lines From A Text File

Jun 17, 2009

I have a list of words that I want to grep in many files to see which ones have it and which ones dont. in the text file I have all the words listed line by line, ex: list.txt:

check
try this
word1
word2
open space
list ..

I want to grep each line one by one. like I want it to

grep "check" *.log
grep "try this" *.log
grep "word1" *.log .. etc how can I do this?

and maybe write the output to a file.

View 5 Replies View Related

Ubuntu :: Python : Remove Some Lines From A Text File?

Sep 6, 2010

I am creating my own address book Python program and I want to create a nction that removes some specified entries. The code looks like this now.

Code:
def remove():
delentry= raw_input('Enter the entry name to delete: ')

[code]...

View 1 Replies View Related

Ubuntu :: Remove Duplicate Lines From A Text File?

Dec 16, 2010

Contained within each of these 67 text files is about 1 million urls. Yes. I have 67 text files that contain 1 million lines of urls each. I am sure I am swimming in duplicates. I tried opening one text file and clicking sort ----->remove duplicates. Now Gedit is not responding my processor is maxed out to 100% and I think I am finally ready to delve into some command line code. Can anyone give me idiot proof instructions on how to sort the duplicates out of each one of these 67 text files? How about no duplicates across all 67?

View 7 Replies View Related

General :: Show Specific Lines In A Text File?

Feb 3, 2011

I have created a text file in Linux, and I only want to show certain users. Here is my text file:

usr user tty Limbo?
11 12:06:13 APW no
12 12:06:13 APW no

[code]...

View 12 Replies View Related

General :: Remove Lone Lines From A Text File?

Jul 6, 2011

anyone has ideas how to remove lone lines from a text file?

If I have a file that is like this:
-----------------------------------
line 1

[code]...

View 14 Replies View Related

Software :: Delete Top Lines Of A Text File Until A Word Is Met?

Jul 7, 2011

I need to chop of the top 30ish lines of several log files until a line starting with "Initialization completed."The trouble is that it's not always the same amount of lines that need to be deleted, and they don't always contain the same information, which is why I would need to delete everything priorhe line starting with "Initialization completed."Right now I have a little script I wrote based on looping each file through several "grep -v" commands with each known pattern of lines I want to ignore, but it is tedious and I have to inspect each file afterwards to make sure nothing is left from above "Initialization completed

View 3 Replies View Related

General :: Script To Read And Compare Two Consecutive Lines In A File?

Jan 18, 2011

I have a file like below

ADP_Comment- 4758
ADP_Comment-is missing
cbdkbckd- 46983

[code]...

View 15 Replies View Related

Ubuntu :: Remove Duplicate Lines In Plain Text File?

Apr 14, 2010

i have a big file of random numbers i generated at some point in time, after working with it with different things(how fun that was)... i want to remove duplicate lines and i'm not sure i'm doing this right

heres the command

Code:
sort random.txt | uniq -u > rand-shorter.txt

the file is pretty big, everything on a new line. i found the command on a web site so i'm sure its correct(bit of a command line in linux newbie)

can anyone confirm if this will remove lines duplicate lines (keeping one copy) and dump what is left in a file named rand-shorter.txt?

EDIT: i think its actually working, just taking a reallllly long time (on an old pen 4 from 2000)

View 8 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 :: Remove Lines From A Syslog Text File That Have Duplicate Strings

Mar 17, 2011

Trying to remove lines from a syslog text file that have duplicate strings

Mar 10 06:51:11[http-8080-1] INFO com.MYCOMPANY.webservices.userservice.web.UserServiceController [u:2533274802474744|360] Authorize [platformI$tformIdAndOs=2533274802474744|360, userRegion=America|360]

then a few lines down

Mar 10 06:52:03 [http-8080-1] INFO com.MYCOMPANY.webservices.userservice.web.UserServiceController [u:2533274802474744|360] Authorize [platformI$tformIdAndOs=2533274802474744|360, userRegion=America|360

got the same thing in terms of a u: number but the issue is I need to remove duplicates and just leave one and the file has multiple duplicates of different u: numbers and it's 14,000 lines long. can anyone tell me if I can use awk? sed? or sort for something like this to? removing lines that have a certain string in there that's a duplicate.

View 4 Replies View Related

General :: Sed - Append Four Commas ',,,,' At The End Of Lines Containing The Pattern 'Response' In A Text File

Nov 5, 2010

Using sed, I am trying to append four commas ',,,,' at the end of lines containing the pattern 'Response' in a text file with lines such as these:

6,Pulse,50,254968,14886,NA,,,,
7,Picture,8,265157,0,1,15045,2,0,15000
7,Response,1,271553,6396,1
7,Pulse,50,274969,9812,NA,,,,
8,Picture,1,290232,0,1,15045,2,0,15000
8,Pulse,50,294969,4737,NA,,,,
[Code].....

View 1 Replies View Related

Ubuntu :: Server 11.04 Boots With White Lines Over Text

Jul 24, 2011

I installed Ubuntu server (32-bit) on a Dimension 2200 (256mb ram, celeron processor). When I boot, i get white and black lines over the screen which makes the text beneath it impossible to see. I've (attempted to) post an image showing this.Is there any way to fix this? The text-mode installer and the GRUB menu display fine.I've used ubuntu on many PCs and never seen this happen, and I couldn't find any results when I googled the issue.

View 2 Replies View Related

Programming :: Read Text File Using Arrays In C++?

Oct 19, 2010

a project using bluetooth to send data byte by byte to external devices buti'm not familiar using arrays to read file from another location before sending the data.If you could,do correct my codes.Here's my code,

void loop(){
char Msg[]={"Hello"};
char *start;

[code]...

View 2 Replies View Related

General :: Read A PID From A Text File And Kill The Corresponding Process?

Jun 26, 2010

I've got a command in a shell script:

Code:
php ./script.php > output.txt & echo $! > script.pid
This results in my script launching as a background process with output routed to

[code]...

View 3 Replies View Related

Programming :: Read Text File (Distribute Its Contents)

Jan 22, 2011

How can read the file /var/etc/allInOne.cfg and distribute its contents on multiple cfg files using C language. /var/etc/allInOne.cfg contain the data and the path of each text file.

The source file "/var/etc/allInOne.cfg "look like this:
line1
line2
...
line10
filePath:/var/etc/file1.cfg
line12
line13
...
line14
filePath:/var/etc/file2.cfg
linen
..
filePath:/var/etc/filen.cfg
the result will be :

The expected result is:
/var/etc/file1.cfg will contain line1 to line10
/var/etc/file2.cfg will contain line 12 to line13
/var/etc/filen.cfg will contain linen to linen-1

View 13 Replies View Related

Programming :: Bash Text To Variable Accessing Individual Text Lines?

May 2, 2010

i am on processing text tasks And i found that if you assign a text to a variable is chomp'ed automatically the newline

Code:

variable=$(cat file.txt)

The problem is i can only access the items/lines using:

Code:

for line in $variable
do
echo $line
# Other commands
done

how do i convert this to an indexed array. More importantly, how do i get access to individual $line[0], ..., $line[n] Another thing, if the file.txt, has lines with spaces it is a mess using the for...in..., but echoing prints line by line...o_0

View 11 Replies View Related

General :: Command To Swap Even And Odd Numbered Lines In A File

May 28, 2010

I'm looking for a command to swap the even/odd numbered lines in a file. Example input file:

Code:

1
2
3
4

[code]...

Example output file:

Code:

2
1
4
3

[code]....

I'm sure there's a way to do it with sed, awk, grep and the like but it's been many years since I've used these commands on a daily basis and I can't seem to figure out the correct syntax.

View 2 Replies View Related

General :: Read Data From Text File And Output Into A Table?

Apr 12, 2010

I'm having a slight dilemma on reading data from a text file and outputting it into a table then displaying it. Basically I'm writing a shell script that takes information from text files then outputs the data into a table with 4 headings.he extracting of the data is fine, but creating a table i'm having problems with. I think it is possible to do it using the awk function, but so far i'm having a lot of difficulties.

View 14 Replies View Related

Programming :: Write A Program Which Will Read Input From A Text File

Apr 7, 2010

i am trying to write a program which will read input from a text file, check if each line contains any alphabets and then display a message imforming me if there is an alphabet in each line. My text file is formatted in this way...

[Code]....

View 2 Replies View Related

Programming :: Shell Script To Read A Certain Segment Of A Text File?

Jun 15, 2010

I have a text file that looks sort of like this:

Code:
blah blah blah
tons of unimportant stuff we don't care about

[code]...

View 3 Replies View Related

General :: Write A C Code To Ping IP Addresses Which Are Read From A Text File?

Aug 3, 2010

i need to write a c code to ping IP addresses which are read from a text file and need to log the response time in another text file.

View 4 Replies View Related







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