Author Topic: Linux command  (Read 1537 times)

ic3y

  • Committee Member
  • Autococker
  • Posts: 1398
Linux command
« on: June 10, 2011, 04:28:26 PM »
Hello, maybe someone can help me.

I have a text file called ip.txt
In this file are ips =O

As Example
Code: [Select]
[13:07:51] newbie connected [91.22.217.218:7516]
[13:07:51] newbie@@@u)=( connected [121.220.206.117:11086]

How I can delete the first part?
I need just this part

Code: [Select]
newbie connected [91.22.217.218:7516]
newbie@@@u)=( connected [121.220.206.117:11086]

Greetz ic3y

Gamabunta

  • Committee Member
  • Autococker
  • Posts: 703
Re: Linux command
« Reply #1 on: June 10, 2011, 04:47:20 PM »
Code: [Select]
cat ip.txt | cut -c 12-100I think that 100 is enough, might not be the best approach but it works.

Edit:
Oh, and if you want to save the output to another file, try:
Code: [Select]
cat ip.txt | cut -c 12-100 | cat > ip2.txtor
Code: [Select]
cat ip.txt | cut -c 12-100 | cat >> ip2.txtWhere ">" overrides specified file, and ">>" adds lines to existing file.

ic3y

  • Committee Member
  • Autococker
  • Posts: 1398
Re: Linux command
« Reply #2 on: June 11, 2011, 03:11:40 AM »
Hm, I had it like this, but now it works.
I had problems with the "cut" part.
Ty Gama

XtremeBain

  • Developer
  • Autococker
  • Posts: 1470
Re: Linux command
« Reply #3 on: June 13, 2011, 11:30:55 AM »
*head explodes*

Code: [Select]
cut -d' ' -f2- ip.txt > ip.$$ && mv ip.$$ ip.txt