Sponsored Content
Top Forums Shell Programming and Scripting How to ignore comments at the end of the each line? Post 302873359 by raj_saini20 on Tuesday 12th of November 2013 02:21:40 AM
Old 11-12-2013
Code:
 awk -F"#" '{print $1}' filename

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sed script, changing all C-comments to C++-comments

I must write a script to change all C++ like comments: // this is a comment to this one /* this is a comment */ How to do it by sed? With file: #include <cstdio> using namespace std; //one // two int main() { printf("Example"); // three }//four the result should be: (2 Replies)
Discussion started by: black_hawk
2 Replies

2. Shell Programming and Scripting

How to filter only comments while reading a file including line break characters.

How do I filter only comments and still keep Line breaks at the end of the line!? This is one of the common tasks we all do,, How can we do this in a right way..!? I try to ignore empty lines and commented lines using following approach. test.sh # \040 --> SPACE character octal... (17 Replies)
Discussion started by: kchinnam
17 Replies

3. UNIX for Advanced & Expert Users

Script to ignore word from a line ...

Hi Gurus, I'm need of a script in which we are finding an independent word ‘boy' in a log file. We are using grep in order to do the same. Now in this log file there are some sentences where we see ‘This is a boy' and we do not want to count word ‘boy' from this sentence. So in other word we want... (2 Replies)
Discussion started by: heyitsmeok
2 Replies

4. Shell Programming and Scripting

Removing Multiple Line comments

:) Hi all, I would like to remove all multiple line comments, in between the pattern /*.....*/ from my file. The comments can be expected to be at any place in my file, like this: /*.... This multi line comment might stretch even the entire file..! ......*/ Some text Text1 /* Comment... (25 Replies)
Discussion started by: Jackuar
25 Replies

5. Shell Programming and Scripting

awk : ignore first 5 line and last line of a file

Hi All, I have text file like as below temp.txt 1 Line temp.txt 2 Line temp.txt 3 Line temp.txt 4 Line temp.txt 5 Line temp.txt 6 Line temp.txt 7 Line temp.txt 8 Line temp.txt N Line I expect the output like as below processing 6 ... processing 7 ... (6 Replies)
Discussion started by: k_manimuthu
6 Replies

6. Post Here to Contact Site Administrators and Moderators

Comments on "How Will the World End?"

I have read the sun-expansion scenario numerous places but I've never read any suggestion that the earth's orbit would increase to avoid being scorched. What mechanism would push it out? As for creating a black hole by the LHC, the whole concept is silly so any number of reasons would rule it... (9 Replies)
Discussion started by: KenJackson
9 Replies

7. Shell Programming and Scripting

Help needed for diff to ignore a line with certain pattern

Hello Guys, I request anyone to do me a small help in using diff command for following. I am trying to compare two files for content and wish to keep the content after the comparison (The resultant file can't be blank) However, the first lines would be different in both files and I need diff... (2 Replies)
Discussion started by: rockf1bull
2 Replies

8. Shell Programming and Scripting

Removing SAS multi line comments in UNIX

i have to remove the commented (/* . . . .*/) part which starts in one line and ends in other.help me with generic code because i have 1000 to 10k lines code which i have to remove. data one; set work.temp; input name age; infile filename; /* dfsdf dsfs sdfdf dsdd sdfsf sdfsf sfs... (4 Replies)
Discussion started by: saaisiva
4 Replies

9. UNIX for Dummies Questions & Answers

Remove multi line and single line comments

Hi, I am trying to remove multi line and single line comments like examples below I have tried this pattern. it works fine for single line comments and multi line comments in a single line only. but this fails when the comments are extended in multiple lines as shown in the comment 2 of... (3 Replies)
Discussion started by: ahmedwaseem2000
3 Replies

10. SCO

Grep to ignore suffix & find end of line

In COBOL, a hyphen can be used in a field name and in a specific program some field names would be identical to others except a suffix was added--sometimes a suffix to a suffix was used. For example, assume I am looking for AAA, AAA-BBB, and AAA-BBB-CCC and don't want to look at AAA-BBB-CCC... (7 Replies)
Discussion started by: wbport
7 Replies
YAP(1)							      General Commands Manual							    YAP(1)

NAME
yap, more - yet another pager SYNOPSIS
yap [ -cnuq ] [ -n ] [ +command ] [ name ... ] DESCRIPTION
Yap is a program allowing the user to examine a continuous text one screenful at a time on a video display terminal. It does so by pausing after each screenful, waiting for the user to type a command. The commands are enumerated later. Yap's main feature is, that it can page both forwards and backwards, even when reading from standard input. The command line options are: -n An integer which is the size (in lines) of a page (the initial page-size. -c Normally, yap will display each page by beginning at the top of the screen and erasing each line just before it displays on it. If your terminal cannot erase a line, yap will clear the screen before it displays a page. This avoids scrolling the screen, making it easier to read while yap is writing. The -c option causes yap to scroll the screen instead of beginning at the top of the screen. This is also done if your terminal cannot either erase a line or clear the screen. -u Normally, yap handles underlining such as produced by nroff in a manner appropriate to the particular terminal: if the terminal can perform underlining well (t.i., the escape sequences for underlining do not occupy space on the screen), yap will underline under- lined information in the input. The -u option supresses this underlining. -n Normally, yap also recognises escape sequences for stand-out mode or underlining mode in the input, and knows how much space these escape sequences will occupy on the screen, so that yap will not fold lines erroneously. The -n option supresses this pattern matching. -q This option will cause yap to exit only on the "quit" command. +command command is taken to be an initial command to yap. Yap uses the termcap(5) database to determine the terminal capabilities and the default page-size. It examines the $TERM environment vari- able to identify the terminal type. If $TERM is not set, it defaults to dumb. Yap Also examines the $TERMCAP environment variable to locate the termcap(5) database. If $TERMCAP is not set, it defaults to /etc/termcap. Yap looks in the $YAP environment variable to pre-set flags. For instance, if you prefer the -c mode of operation, just set the $YAP envi- ronment variable to -c. The commands of yap can be bound to sequences of keystrokes. The environment variable $YAPKEYS may contain the bindings in the form of a list of colon-separated `name=sequence' pairs. The name is a short mnemonic for the command, the sequence is the sequence of keystrokes to be typed to invoke the command. This sequence may contain a ^X escape, which means control-X, and a X escape, which means X. The latter can be used to get the characters `^', `' and `:' in the sequence. There are two keymaps available, the default one and a user-defined one. You can switch between one and the other with the change keymap command. The yap commands are described below. The mnemonics for the commands are given in parentheses. The default key sequences (if any) are given after the mnemonic. Every command takes an optional integer argument, which may be typed before the command. Some commands just ignore it. The integer argument is referred to as i. Usually, if i is not given, it defaults to 1. visit previous file (bf) P Visit the i-th previous file given in the command line. scroll one line up or go to line (bl) ^K or k If i is not given, scroll one line up. Otherwise, i will be interpreted as a line number. A page starting with the line indicated will then be displayed. bottom (bot) l or $ Go to the last line of the input. display previous page (bp) - Display the previous page, consisting of i lines, (or page-size lines if no argument is given). display previous page and set pagesize (bps) Z Display the previous page, consisting of i lines, (or page-size lines if no argument is given). If i is given, the page-size is set to i. scroll up (bs) ^B Scroll up i lines (or scroll-size lines if i is not given. Initially, the scroll-size is 11). search backwards for pattern (bse) ? Search backwards for the i-th occurrence of a regular expression which will be prompted for. If there are less than i occurrences of the expression, the position in the file remains unchanged. Otherwise, a page is displayed, starting two lines before the place where the expression was found. The user's erase and kill characters may be used to edit the expression. Erasing back past the first character cancels the search command. Note: Some systems do not have regex(3). On those systems, searches are still supported, but regular expressions are not. skip lines backwards (bsl) S Skip i lines backwards and display a page. skip pages backwards (bsp) F Skip i pages backwards and display a page. scroll up and set scrollsize (bss) b Scroll up i lines (or scroll-size lines if i is not given. If i is given, the scroll-size is set to i. change key map (chm) ^[ Change from the current key map to the other (if there is one). exchange current page and mark (exg) x Set the mark to the current page, and display the previously marked page. visit next file (ff) N Visit the i-th next file given in the command line. scroll one line down or go to line (fl) ^J or ^M or j If i is not given, scroll one line down. Otherwise, i will be interpreted as a line number. A page starting with the line indicated will then be displayed. display next page (fp) <space> Display the next page, consisting of i lines, (or page-size lines if no argument is given). display next page and set pagesize (fps) z Display the next page, consisting of i lines, (or page-size lines if no argument is given). If i is given, the page-size is set to i. scroll down (fs) ^D Scroll down i lines (or scroll-size lines if no argument is given). search forwards for pattern (fse) / Search forwards for the i-th occurrence of a regular expression which will be prompted for. If there are less than i occurrences of the expression, the position in the file remains unchanged. Otherwise, a page is displayed, starting two lines before the place where the expression was found. The user's erase and kill characters may be used to edit the expression. Erasing back past the first character cancels the search command. Note: Some systems do not have regex(3). On those systems, searches are still supported, but regular expressions are not. skip lines forwards (fsl) s Skip i lines and display a page. skip pages forwards (fsp) f Skip i pages and display a page. scroll down and set scrollsize (fss) d Scroll down i lines (or scroll-size lines if i is not given. If i is given, the scroll-size is set to i. help (hlp) h Give a short description of all commands that are bound to a key sequence. set a mark (mar) m Set a mark on the current page. repeat last search (nse) n Search for the i-th occurrence of the last regular expression entered, in the direction of the last search. repeat last search in other direction (nsr) r Search for the i-th occurrence of the last regular expression entered, but in the other direction. quit (qui) Q or q Exit from yap. redraw (red) ^L Redraw the current page. repeat (rep) . Repeat the last command. This does not always make sense, so not all commands can be repeated. shell escape (shl) ! Invoke the shell with a command that will be prompted for. In the command, the characters `%' and `!' are replaced with the current file name and the previous shell command respectively. The sequences `\%' and `!' are replaced by `%' and `!' respectively. The user's erase and kill characters can be used to edit the command. Erasing back past the first character cancels the command. pipe to shell command (pip) | Pipe the current input file into a shell command that will be prompted for. The comments given in the description of the shell escape command apply here too. go to mark (tom) ' Display the marked page. top (top) ^^ Display a page starting with the first line of the input. visit file (vis) e Visit a new file. The filename will be prompted for. If you just type a return, the current file is revisited. write input to a file (wrf) w Write the input to a file, whose name will be prompted for. The commands take effect immediately, i.e., it is not necessary to type a carriage return. Up to the time when the command sequence itself is given, the user may give an interrupt to cancel the command being formed. AUTHOR
Ceriel J.H. Jacobs FILES
/etc/termcap Terminal capabilities data base SEE ALSO
termcap(5), regex(3). BUGS
Yap will find your terminal very stupid and act like it, if it has no way of placing the cursor on the home position, or cannot either erase a line or insert one. In lines longer than about 2000 characters, a linefeed is silently inserted. The percentage, given in the prompt when yap reads from a file (and knows it), is not always very accurate. local YAP(1)
All times are GMT -4. The time now is 07:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy