Hello, i am new to the forum and know nothing about programing, Linux or Unix hope somebody can help me out.
I have a .txt file that i need to delete certain lines from. After searching the forum i noticed that using "sed" was the way to go, so i installed gnuwin32 (i use windows xp ) and started deleting lines with an specific value using this command:
but now i would like to delete lines that fall into a certain category, for example lines with "more than 3 numbers" or "less than 4 characters".
This is a lot more complicated, or at least it seems that way to me, so if anyone knows how to do it i would appreciate the help, thanks.
Thanks for your response! but i couldnt get it to work, i tried:
But that didnt change anything, notice that i dont use single quotes cause i dont know how to write them in gnuwin, i press alt+39 and instead of getting " ' " i get something like this " ` " and i get "unknown command", could that be the reason?
And to make it "delete lines with more than 4 numbers" it would be something like these right?
But since i am doing something wrong or the code is missing something it doesn't work.
Then regarding this:
I like this code, since this section of the code:
is a lot simpler than getting the same results on "sed" alone, but i dont have "bash" in my gnuwin32 files, i downloaded it, but can it be used from the gnuwin32 console at all? i couldn't even run the install from the bash folder.
Sorry but as i said, i dont know anything about this, so i can do little on my own.
Hi, I was reading a lot of forums about editing *.txt files due to problem i have: I need to write something that will delete all lines that are different from:
"...
xxxx
1234 xxxx
5678 xxxx
..."
Where "xxxx" is whatever signs, numbers or letters, but ends with a new line...
i was trying to do it in ANSI C, but reading about it made me realize that it may not be the best solution... anybody can help?
Hi,
I'm having trouble in achieving the following scenario. There is a txt file with thousands of lines and few lines are repeated, which needs to be removed using a script.
File.txt
20140522121432,0,12,ram
Loc=India
From=ram@xxx.com, To=ravi@yyy.com,,
1
2
3
4
.
.
30... (18 Replies)
Hi
I have a file with contents:
NAMES
John
carrey
williams
How can I get all the names and store them in seperate variables(or arrays)
please keep in mind that the no. of such names is not known.Three here is a bogus value
~thanks (4 Replies)
I have a diff command that does what I want but when comparing large text/log files, it uses up all the memory I have (sometimes over 8gig of memory)
diff file1.txt file2.txt | grep '^<'| awk '{$1="";print $0}' | sed 's/^ *//'
Is there a better more efficient way to find the lines in one file... (5 Replies)
Well, to make another post at this helpful forum :b::D:
I recently tried something like this, I want to replace all those numberings/letters that are located
between <string>file://localhost/var/mobile/Applications/ and /Documents/</string>
numberings =----
replace with:
first... (6 Replies)
Hi everyone,
I have two files (A and B) and want to combine them to one by always taking 10 rows from file A and subsequently 6 lines from file B. This process shall be repeated 40 times (file A = 400 lines; file B = 240 lines).
Does anybody have an idea how to do that using perl, awk or sed?... (6 Replies)
I have one base file, and multiple target files-- each have uniform line structure so no need to use grep to find things-- can just define sections by line number.
My question is quite simple-- can I use sed to copy a defined block of lines (say lines 5-10) from filename1.txt to overwrite an... (3 Replies)
Hi,
now i need to remove the entires i inserted into my .txt file.
echo -n "Title: "
read Title
echo -n "Author: "
read Author
if grep -q "$Title: $Author" "BookDB.txt"; then
sed '$Title: $Author' BookDB.txt
echo "Book Title '$Title' removed successfully!"
... (6 Replies)
Hi,
I have to programming a program in shell script which combine a lot of .txt files. But in all of these files the program had to delete the first both lines.
Because I don't know anything about shell script I need your help.
Does anyone have a command or a hint, where I can look for?
... (1 Reply)
Hi,
I have to programming a program in shell script which combine a lot of .txt files. But in all of these files the program had to delete the first both lines.
Because I don't know anything about shell script I need your help.
Does anyone have a command or a hint, where I can look for?
... (1 Reply)
I need some help deleting lines in a file that contain spaces. Im sure awk or sed will work but i dont know much about those commands. Any help is appreciated :D (7 Replies)