LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-02-2018, 02:58 PM   #1
Thom Linde
LQ Newbie
 
Registered: Oct 2018
Posts: 1

Rep: Reputation: Disabled
extract part of text from txt fle


Hey guys,
I have a file named cookies.txt and I need to create two data blocks. Every block must have some part of information from cookies file, for example:

cookie1=10 letters from cookies.txt
cookie2=17 letters from cookies.txt

I tried awk and grep but neither of them works.. :|

Many thanks!
 
Old 10-02-2018, 03:03 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
please give sample snippet of actual file, and commands you tried with there output, and results desired.
 
Old 10-02-2018, 03:04 PM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,101

Rep: Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365
insufficient information.
Is this your homework?
What did you exactly try (awk script and grep and ...)? What is the original input file? What is that "some part of information"?
 
Old 10-03-2018, 12:28 AM   #4
Honest Abe
Member
 
Registered: May 2018
Distribution: CentOS 7, OpenSUSE 15
Posts: 420
Blog Entries: 1

Rep: Reputation: 202Reputation: 202Reputation: 202
10/17 letters or words ?
Words can be pretty easy with awk. Show examples of your failed attempts with awk.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bash script: extract filename from txt and rename files Lexus45 Programming 6 11-01-2015 10:44 AM
[SOLVED] extract just the package name without version number from .txt file socalheel Programming 5 11-06-2014 08:43 PM
2 .txt files trying to extract data from master file rhbegin Programming 5 01-04-2012 08:53 AM
extract last few of line data from txt file irwinyeo Programming 7 12-20-2011 09:47 AM
Extract certain text info from text file xmrkite Linux - Software 30 02-26-2008 11:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration