General :: Save Each Line From Textfile As New File?
Jul 4, 2011
just started with Linux and I'm trying to create new files for each line of my input file. So I have file with 637 lines of data:
2 4 6
2 8 5
3 0 5
etc
and want to create a new file from each line. With
cat name.txt | awk '{ line = $0
print line
}'
I nicely see all lines, but what rests is to save each line separately into new file. I tried While read line command in combination with output >> $.txt, but didn't work well..
View 8 Replies
ADVERTISEMENT
Apr 1, 2010
need a script to achieve saving multiple text files as 0001 0002 0003 etc.or moving files to a folder displayed this way..there prolly is an " if " statement involved also...if 0001 exist then %+1 and so on.
View 1 Replies
View Related
Mar 10, 2011
I wish to append a text at the start of every line and save it to another file without changing the original file.know the command
For example:
Orignal.txt
a.txt
[code]...
View 5 Replies
View Related
Feb 8, 2010
I have a text file example :
word1
word2
word4
[code]...
View 3 Replies
View Related
Apr 28, 2011
Can save an image from clipboard into file using command line?
may be image magic?
View 3 Replies
View Related
May 1, 2010
simple scan error as follows: Failed to save file ImageMagick returned error code 11 Command line: convert -adjoin /tmp/simple-scan-DA9MBV.jpg /tmp/simple-scan-XCK4BV.jpg /tmp/simple-scan-NZVYBV.pdf Stdout: Stderr: using karmic note: I have apparmor extra profiles installed but didn't notice one that related to simple scan or imagemagick. Red herring or not?
View 6 Replies
View Related
Jul 7, 2010
I have two text files on Linux. One contains a list of valid IDs. E.g:
abcd
efgh
ijkl
etc.
The other contains a list of invalid IDs. But, some of these also appear on the list of valid IDs, in this example "efgh":
mnop
qrst
efgh
etc.
How can I easily construct a text file that contains all the lines from the invalid list that do not appear in the valid list? That is, I want to end up with a text file that has:
mnop
qrst
etc.
I'd like either some Linux commandline magic of some clever Vim trickery.
View 3 Replies
View Related
Mar 9, 2010
I use avg free as antivirus scanner. I looked some time for a scanner to scan and remove viruses. Problem is avg 8.5 will only detect viruses, not remove them...I use a oneliner looking like this:
Code:
/usr/bin/avgscan / -x /mnt -x /dev --heur --ignerrors -r /var/log/"scanlog"`eval date +%Y%m%d`".txt"
[code]...
View 5 Replies
View Related
Dec 23, 2009
I am trying to write a script that takes an input file ($FileName) and an intermediate file ($FileName.info) and removes lines from $FileName if the value in $2 of $FileName.info is <75.
I can't figure out how to feed only one line of the .info file to the if statement at a time so that it will perceive it as an integer instead of a list.
The error I am getting now is ./script.sh: line 6: [: : integer expression expected
Sample input $FileName
Code:
Code:
Code:
Script so far:
Code:
View 10 Replies
View Related
Aug 2, 2010
I've written a script to parse a file and print each line that ends with matching pattern, if the next line is blank. The pattern lines are the result of md5sum $i|sed 's/path///g' so that only md5 and filename appear. Here's what I'm using.
Quote:
for fline in `sed -n '/.*.ext$/p' file1`
do
if [ "`sed -n -e '/'"$fline"'/ {n; p;}' file1`" == "" ]
then
echo ""$fline" has no info" >>file2
fi
done
[Code]....
View 4 Replies
View Related
Feb 24, 2011
I'd like show a certain line or lines of a file with context, kind of like a unified diff, on the command line in Linux:
$ (something) -l 154 stuff.py
150: def foo(bar):
151: """
[code]....
View 5 Replies
View Related
Apr 1, 2011
I am combining data from a couple different input files and creating an output file in a specific format. I notice that if I use the >> operator, information gets appended to a new line in my output file. This is useful, but if I'd like to append onto the CURRENT line, is there an easy way to do this? I've been googling around and see lots of complicated answers, nothing that suggests to me an easy way to do this. For example, if my output file looks like this:
b1a:] cat test
hello my name is
b1a:]
and I'd simply like to append "Bob", how can I do it? If I use
b1a:] echo Bob >> test
b1a:] cat test
b1a:] hello my name is
Bob
b1a:]
So what I would prefer is some command that would create the result:
hello my name is Bob
View 14 Replies
View Related
Feb 13, 2011
I want to access a file, and check the length of every line.After, i want to check and replace all lines with length over 10 characters, with a message.Does anyone have a clue on that?
View 1 Replies
View Related
Feb 3, 2011
How can I save a file in /usr/local/lib/cnet? I'm trying to save a GIF image in the CNET resource folder to use for a simulation. It says permission denied, and when I try to chmod the folder it gives me the error "not permitted".
View 1 Replies
View Related
Feb 13, 2011
How do I save a file edited with the VI editor? How do I get help information on this program?
View 1 Replies
View Related
Aug 15, 2010
I have copied some vides from my camcorder and the size seems a bit excessive - 140mb for 3 mins! Is there a program I can use to save the .mp2 file as .mpg and reduce the size?
View 2 Replies
View Related
Jul 9, 2011
I want to save a xgraph derived by performance comparison of reactive and proactive protocols in MANET.. For doing this, I clicked the hardcopy button and select the device/file to save the file... but nothing happens... and 1 more query is that i have searched the whole Internet to find why the packets are not transferring in Tora...But I could not find it.
View 6 Replies
View Related
Jul 1, 2010
I am using:
user@unknown:~$ sudo command -option > log
to save the results of "command" to the file "log", but I'd like to also get the result on the terminal, is this possible?
I am using ubuntu 10.04 lts.
View 3 Replies
View Related
Jul 25, 2010
For example, I run a program called "luck" and it outputs a sentence like "good luck". Then "./luck -> logfile" will save the output content to logfile.But when I run another program called "hello" and it outputs a sentence lie " Hello world".Then "./hello-> logfile" will save the output content to logfile and wipe the previous contents.Is is possible to keep both sentences in the logfile? Just like
View 2 Replies
View Related
Aug 23, 2011
I need to be able to convert HTML email messages saved as text files (.eml or .msg) to PDF documents, one PDF per email, retaining formatting and images.
Are there any Linux tools that will allow me to do this from the command line (so it can be scripted)?
View 1 Replies
View Related
Sep 14, 2010
I've found these commands in [URL]:
Quote:
find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/boot.cat | sudo tee md5sum.txt
But I don't understand these commands, even after reading their manuals.
View 4 Replies
View Related
Nov 28, 2010
I am using Xfce as the desktop enviroment and Mozilla Firefox as the webrowser. Within the webrowser window, I do File>Save Page As. I save it, and the result is almost always foo.html and directory foo_files. But I think under KDE I could choose the format, one of them being something like "Single page" (only one file; the colecction of .png, etc is embedded into that file). And this is the format I want Xfce (or Firefox) to use when downloading to hdd.
View 1 Replies
View Related
Jun 9, 2010
How do I save it as a jpg somewhere on my puter using a script? I can wget, but it gets saved as a .evif, which is totally useless. I can right-click on the image in a browser and use the context menu to save it as a jpg, but I want this process automated. How can I DL this image and save it as a jpg? GIMP's CL options don't include the capacity to save/convert this image, though it's possible from teh GUI. ImageMagick won't read this dynamic URL. What do I do?
View 3 Replies
View Related
May 30, 2010
is there a Terminal command to open a Target file (same as the one opens when you want to upload a file), let user choose the file and when he clicks open, be able to save his choice?for example:echo "Choose source file"--> command needed to browseand then open or save path to that file
View 1 Replies
View Related
Jun 5, 2010
i have custom programs written in Basis pro5. Standard output to a pdf virtual printer works fine. Using pdftk to overlay on to a form is hit or miss.... There are products out there like Unform that are just too expensive for my company. i have purchased another product from a company that prints the forms to the laser perfectly but i am incapable of capturing them and saving them as pdf's for archiving/emailing/faxing and i don't much care for this company.
View 2 Replies
View Related
Oct 27, 2010
I know how to display contents at the end of beginning of a file or even at specific lines but how to you display a file from line # to the end of the file?
View 5 Replies
View Related
Jan 26, 2010
I actually pretty much abandoned Ubuntu a few weeks back after several weeks of not getting a couple things working properly.One of the big problems is I couldn't get my line-in audio jack working to save my life (despite working flawlessly in Windows on the same machine).I have posted about this numerous times and had no luck despite many of you good people attempting to assist.Tonight, I put a live CD of Linux Mint in my machine and noticed a few of the little problems I have with Ubuntu seemed to be "fixed" with Linux Mint.
That's when it hit me that perhaps the big difference is 32 vs. 64 bit? My Ubuntu is 64 bit but the Linux Mint I tested is 32. Does anybody think that my audio problem could be as simple as getting away from Ubuntu 64 bit?Also, can anybody tell me if there is a Terminal Services Client available for Mint? I'm sure there is but it didn't seem to be in the default install..
View 2 Replies
View Related
Feb 1, 2011
How can I put a value of a php variable into a text file. I cant append or write the values into a text file.
View 2 Replies
View Related
Jun 10, 2011
I have a text file that contains a single word and I want to write a bash script that will read the word from the text file... The following is my incorrect attempt, as it assigns the name of the textfile to the variable as opposed to the word stored within the textfile:(assume I have a text file value.txt that has as its contents a single word, say wordone)
#!/bin/sh
for f in value.txt
do
echo $f
done
so the output of the above script is value.txt, however I want it to be wordone.to summarise: how do I assign the value of the word contained within a textfile to a variable?
View 2 Replies
View Related
May 29, 2010
I've never programed shell scripting.
Code goes like so:
I simply want to read a file "data.txt" line by line Then char by char and add them into a result var. The file is supossed to always contain numeric values
View 8 Replies
View Related