Change the file style to another version with awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Change the file style to another version with awk
# 1  
Old 07-08-2012
Change the file style to another version with awk

Code:
#cat myfile
libgcc: Package > additional *crt*.o files for PPC  libgcc: Package > additional *crt*.o files for PPC
binutils: Default to n64 when configured for mips64  binutils: Default to n64 when configured for mips64
             > gcc-4.6, gcc-4.7: Add support for building mips64 cross compi
             > eglibc: fix build with poky-tiny distro
             > eglibc: Add patch to fix /var installation location
             > eglibc: Add patch to fix /var installation location

to get
Code:
gcc-4.6, gcc-4.7: Add support for building mips64 cross compi
eglibc: fix build with poky-tiny distro
eglibc: Add patch to fix /var installation location
eglibc: Add patch to fix /var installation location

# 2  
Old 07-08-2012
Something like this would help,

Code:
 grep "^>" myfile.txt | awk -F">" {print $2}

# 3  
Old 07-08-2012
Code:
awk -F"^[ \t]+>[ \t]*" 'NF>1{print $NF}' myfile


Last edited by elixir_sinari; 07-08-2012 at 09:05 AM..
This User Gave Thanks to elixir_sinari For This Post:
# 4  
Old 07-08-2012
For spaces only:
Code:
sed -n 's/^ *> //p' infile

to also match TAB's
Code:
sed -n 's/^[[:space:]]*>[[:space:]]//p' nfile

This User Gave Thanks to Scrutinizer For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Using sed to change file into an awk script

Hi I want to use sed to change a text files input into an awk script. For example if the input says " chord -- english " I want to change this using sed 's/pattern 1 /pattern 2 /'g filename but I don't understand how to use part of the pattern 1 to input that into pattern 2 . Like after... (10 Replies)
Discussion started by: enforcer
10 Replies

2. Shell Programming and Scripting

Copy a file from directroy/ prior version to the directory/ new version

How to copy a file from directroy/ prior version to the directory/ new version automatically. (4 Replies)
Discussion started by: roy1912
4 Replies

3. Shell Programming and Scripting

Change a file content format using awk

Hi, i have a file input.txt Continent North America Country USA Capital Washington D.C. Country Canada Capital Ottawa Continent South America Country Argentina Capital Buenos Aires Country Brazil Capital Brasília Coutry Colombia Capital Bogotá and i want to get an output.txt ... (3 Replies)
Discussion started by: fastlane3000
3 Replies

4. Red Hat

To change of remote printer font style

How can I change the remote printer font style as its been printing in a non readable format. Is it possible to change it from the server console. (0 Replies)
Discussion started by: gsiva
0 Replies

5. Programming

How do I change html style dynamically

I've got the following form element in a template driven web page... <INPUT type="text" class="normal" id="LastName" name="LastName" value="{LastName}"> The stylesheet description is simply... input.normal { width: 250; } I want to change the background colour of the input box after the user... (0 Replies)
Discussion started by: JerryHone
0 Replies

6. Shell Programming and Scripting

awk one line, change \n to sth in a file

Hi Everyone, cat 1.txt aaa bbb ccc outout will be cat 2.txt ,,aaa,,bbb,ccc,, means change "\n" to ",,", and add ",," into the beginging and ending. right now i am using perl while to open and read the file, then split \t, feel not nice. please advice. and i hear using perl... (8 Replies)
Discussion started by: jimmy_y
8 Replies

7. Programming

GNUPLOT- how to change the style of data points

Hi, I am trying to arrange my graphs with GNUPLOT. Although it looked like simple at the beginning, I could not figure out an answer for the following: I want to change the style of my data points (not the line, just exact data points) The terminal assigns first + and then x to them but what I... (0 Replies)
Discussion started by: natasha
0 Replies

8. Shell Programming and Scripting

how to change the current file processing to some other random file in awk ?

Hello, say suppose i am processing an file emp.dat the field of which are deptno empno empname etc now say suppose i want to change the file to emp.lst then how can i do it? Here i what i attempted but in vain BEGIN{ system("sort emp.dat > emp.lst") FILENAME="emp.lst" } { print... (2 Replies)
Discussion started by: salman4u
2 Replies

9. Shell Programming and Scripting

awk, sed, grep...weird style

my desired output is like this: so the thing is, I only need to show every of this part out but the frequency of that data is not fixed, so sometimes it may have 4 lines, or 6 lines or whatever in that file. However, the last line will always have empty space/line below it. (13 Replies)
Discussion started by: finalight
13 Replies
Login or Register to Ask a Question