General :: View File Ignoring Set Of Lines?
Jun 21, 2010I'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 RepliesI'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 RepliesI 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 RelatedI 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 RelatedI have the following content on the source directory:
source/foo.txt
source/bar/another_file.txt
source/bar2/and_another.txt
I want copy those files to a destination directory which, after copy, shall look like this:
destination/foo.txt
destination/another_file.txt
destination/and_another.txt
How can I do this? It seems that "cp" lacks such an option
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].....
How can I check and set who can view or open a given folder or file?
View 1 Replies View RelatedI 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 RelatedI 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 RelatedI 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?
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"?
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 RelatedI 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 RelatedI need to read a binary file using my C++ application. That binary file may contain arbitary characters and it also contains 0 at some places. I need to read the file without considering null terminating character. (i.e. considering 0 as a normal byte and not as the end of the string)Can some one suggest me a method to read the buffer while ignoring the null terminated character.
View 4 Replies View Relatedi have a doubt regarding chm file.how to view chm file in redhat linux EL5
View 4 Replies View RelatedI 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 RelatedI 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
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 View Relatedi'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 RelatedI have following contents
I want to grep "#2" and want the output as
How to using shell script?
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.
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 RelatedI use the
Code:
wget -r -A <extension> <site>
command to download all files from a certain site. this time i already have some of the files already downloaded and listed in a text file via
Code:
ls > <text file name>
How can i make wget to download from the site i want but ignore the filenames listed in the text file?
i have a doubt regarding chm file.how to view chm file in redhat linux EL5
View 2 Replies View RelatedI am working on a linux cluster based on Scientific Linux 5. I have some images in .bmp format. How can i view them from the command line or without downloading to desktop? At present I am connecting from Win7 using Exceed.
View 4 Replies View RelatedFor example, I write the file like in vi or something. I wanna execute but no one read , write and execute but one more thing no one to view the file like encrypt the file.
View 5 Replies View Relatedhow can we view a file with its inode nno . eg. cat 12456 where 12345 is the inode of a file
View 3 Replies View RelatedI 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.
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.
Is there any commands or scripts to remove only selected line in the history file.
View 1 Replies View Relatedi am having following lines in a file called test.
subscribe parser for dinesh
extend size for dinesh
subscribe parser for anish
unsubscribe parser for dinesh
extend size for arvind
I want to delete all lines which contains the string "dinesh". Is it possible.