Sponsored Content
Top Forums Shell Programming and Scripting filtering out duplicate substrings, regex string from a string Post 302429759 by bartus11 on Tuesday 15th of June 2010 12:14:42 PM
Old 06-15-2010
I don't know how to make it work in sed. "||" works as "exclusive or" in perl so it checks if first command was successful, and if it was then second one is not processed. (\w+)\1 matches first occurance of consecutive duplicate strings (it is extension of "(\w)\1", which would match consecutive duplicate characters, like "aa","bb" and so on).
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Filtering text from a string

I'm trying to write a script which prints out the users who are loged in. Printing the output of the "users" command isn't the problem. What I want is to filter out my own username. users | grep -v (username) does not work because the whole line in which username exists is suppressed. If... (5 Replies)
Discussion started by: Cozmic
5 Replies

2. Shell Programming and Scripting

Need help in string filtering (KSH)

Hi all, I'm interested in printing out only the prefix of a formatted set of filenames. All files of this type have the same 8 character suffix. I'm using KSH. Is there a command I could use to print the filenames, less the last 8 characters? Was thinking of using sed 's/<last 8 chars>//',... (1 Reply)
Discussion started by: rockysfr
1 Replies

3. Shell Programming and Scripting

filtering string

hlow all i need help for my case i want to get variable 20(in bold) but filter in print $3 not $2 so this input 95:20111005_20111123:1821546322 96:20111005_20111123:0053152068 97:20111005_20111123:1820960407 98:20111005_20111123:2021153102 99:20111005_20111123:2021153202... (4 Replies)
Discussion started by: zvtral
4 Replies

4. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

5. Shell Programming and Scripting

Filtering protocol and string in tcpdump command?

Hello to all in forum, Maybe some unix expert could help me. I have the following tcpdump command: tcpdump -i any port 13907 -s 0 -w Out.cap I would like to run tcpdump to only capture data related with especific string. Within the dump the protocol is GSM MAP and the string is Address... (0 Replies)
Discussion started by: cgkmal
0 Replies

6. Shell Programming and Scripting

KSH: Split String into smaller substrings based on count

KSH HP-SOL-Lin Cannot use xAWK I have several strings that are quite long and i want to break them down into smaller substrings. What I have String = "word1 word2 word3 word4 .....wordx" What I want String1="word1 word2" String2="word 3 word4" String3="word4 word5" Stringx="wordx... (5 Replies)
Discussion started by: nitrobass24
5 Replies

7. Shell Programming and Scripting

Extracting substrings from a string of variable length

I have a string like Months=jan feb mar april x y .. Here the number of fields in Months is not definite I need to extract each field in the Months string and pass it to awk . Don't want to use for in since it is a loop . How can i do it (2 Replies)
Discussion started by: Nevergivup
2 Replies

8. Shell Programming and Scripting

Need Help of filtering string from a file.

HI All, We have an Redhat Machine, And some folder with couple simple text files, this files containing a lot of lines with various strings and IP address with different classes. The Requirement in eventually , is to pass the all various IP addresses to Excel. My question is : what is... (4 Replies)
Discussion started by: James Stone
4 Replies

9. Shell Programming and Scripting

Remove not only the duplicate string but also the keyword of the string in Perl

Hi Perl users, I have another problem with text processing in Perl. I have a file below: Linux Unix Linux Windows SUN MACOS SUN SUN HP-AUX I want the result below: Unix Windows SUN MACOS HP-AUX so the duplicate string will be removed and also the keyword of the string on... (2 Replies)
Discussion started by: askari
2 Replies

10. Shell Programming and Scripting

Grep with regex containing one string but not the other

Hi to you all, I'm just struggling with a regex problem and I'm pretty sure that I'm missing sth obvious... :confused: I need a regex to feed my grep in order to find lines that contain one string but not the other. Here's the data example: 2015-04-08 19:04:55,926|xxxxxxxxxx| ... (11 Replies)
Discussion started by: stresing
11 Replies
GITIGNORE(5)							    Git Manual							      GITIGNORE(5)

NAME
gitignore - Specifies intentionally untracked files to ignore SYNOPSIS
$GIT_DIR/info/exclude, .gitignore DESCRIPTION
A gitignore file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected; see the NOTES below for details. Each line in a gitignore file specifies a pattern. When deciding whether to ignore a path, Git normally checks gitignore patterns from multiple sources, with the following order of precedence, from highest to lowest (within one level of precedence, the last matching pattern decides the outcome): o Patterns read from the command line for those commands that support them. o Patterns read from a .gitignore file in the same directory as the path, or in any parent directory, with patterns in the higher level files (up to the toplevel of the work tree) being overridden by those in lower level files down to the directory containing the file. These patterns match relative to the location of the .gitignore file. A project normally includes such .gitignore files in its repository, containing patterns for files generated as part of the project build. o Patterns read from $GIT_DIR/info/exclude. o Patterns read from the file specified by the configuration variable core.excludesfile. Which file to place a pattern in depends on how the pattern is meant to be used. o Patterns which should be version-controlled and distributed to other repositories via clone (i.e., files that all developers will want to ignore) should go into a .gitignore file. o Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user's workflow) should go into the $GIT_DIR/info/exclude file. o Patterns which a user wants Git to ignore in all situations (e.g., backup or temporary files generated by the user's editor of choice) generally go into a file specified by core.excludesfile in the user's ~/.gitconfig. Its default value is $XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/ignore is used instead. The underlying Git plumbing tools, such as git ls-files and git read-tree, read gitignore patterns specified by command-line options, or from files specified by command-line options. Higher-level Git tools, such as git status and git add, use patterns from the sources specified above. PATTERN FORMAT
o A blank line matches no files, so it can serve as a separator for readability. o A line starting with # serves as a comment. Put a backslash ("") in front of the first hash for patterns that begin with a hash. o An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. If a negated pattern matches, this will override lower precedence patterns sources. Put a backslash ("") in front of the first "!" for patterns that begin with a literal "!", for example, "!important!.txt". o If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find a match with a directory. In other words, foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo (this is consistent with the way how pathspec works in general in Git). o If the pattern does not contain a slash /, Git treats it as a shell glob pattern and checks for a match against the pathname relative to the location of the .gitignore file (relative to the toplevel of the work tree if not from a .gitignore file). o Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the pathname. For example, "Documentation/*.html" matches "Documentation/git.html" but not "Documentation/ppc/ppc.html" or "tools/perf/Documentation/perf.html". o A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning: o A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo". o A trailing "/" matches everything inside. For example, "abc/" matches all files inside directory "abc", relative to the location of the .gitignore file, with infinite depth. o A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. o Other consecutive asterisks are considered invalid. NOTES
The purpose of gitignore files is to ensure that certain files not tracked by Git remain untracked. To ignore uncommitted changes in a file that is already tracked, use git update-index --assume-unchanged. To stop tracking a file that is currently tracked, use git rm --cached. EXAMPLES
$ git status [...] # Untracked files: [...] # Documentation/foo.html # Documentation/gitignore.html # file.o # lib.a # src/internal.o [...] $ cat .git/info/exclude # ignore objects and archives, anywhere in the tree. *.[oa] $ cat Documentation/.gitignore # ignore generated html files, *.html # except foo.html which is maintained by hand !foo.html $ git status [...] # Untracked files: [...] # Documentation/foo.html [...] Another example: $ cat .gitignore vmlinux* $ ls arch/foo/kernel/vm* arch/foo/kernel/vmlinux.lds.S $ echo '!/vmlinux*' >arch/foo/kernel/.gitignore The second .gitignore prevents Git from ignoring arch/foo/kernel/vmlinux.lds.S. SEE ALSO
git-rm(1), git-update-index(1), gitrepository-layout(5), git-check-ignore(1) GIT
Part of the git(1) suite Git 1.8.3.1 06/10/2014 GITIGNORE(5)
All times are GMT -4. The time now is 05:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy