A script to delete the X first chars of a .txt file

peet69

Newbie
Joined
Dec 26, 2010
Messages
48
Reaction score
8
hello,

im looking for a script or something similar, which deletes the first X (1,2,3 or more, should be configurable) chars of a .txt file.

basically the .txt file looks like this

Code:
1. http://xxxxxxx
2. http://xxxxxxx
.....
123. http://xxxxxxx
.....
8171. http://xxxxxxx

and after using the script it should be only

Code:
http://xxxx

i already tried to google, but did not found anything.

help would be really appreciated, thanks
 
Nope. Notepad doesn't have that function. You can download Notepad++ for free http://download.tuxfamily.org/notepadplus/5.9/npp.5.9.Installer.exe
 
If you're looking for another option, save this file as edit_text.php and upload it to one of your domains, then go to that url in your browser. It gives you a text box; paste your text into the box and click submit, it will delete everything before the http:// on each line.

Code:
<?php

if($_POST['save'] == 'yes') {
	$text = $_POST['current'];
	$text = explode("\n", $text);
	foreach($text as $line) {
		$line = preg_replace('/.*http/', 'http', $line);
		$output .= "$line\n";
	}

	echo "<pre>
$output
</pre>
";

	exit;
}


echo '<html>
<head>
<title>Edit text</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta name="robots" content="noarchive">
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
Post your text in here:<br>
<form action="'. $_SERVER['PHP_SELF'] .'" method="post">
<textarea rows="30" cols="110" name="current" wrap="off">
</textarea><br>
<br>
<input type="hidden" name="save" value="yes">
<input type="submit" name="submit" value="Save">
</form>
<br>
</body>
</html>';

?>
 
There are 2 texteditors that should be in your basic toolkit.
Not only for this specific problem but for all kinds of text manipulation.

Notepad++ (as bezopravin recommended)

and

Textmaster
Code:
http://www.nontube.com/products/text-master/

Both are free.
 
Back
Top